value.java

来自「大家好啊 快来抢购J2ME东东 挺不错的啊 不要后悔啊 抓住机会」· Java 代码 · 共 78 行

JAVA
78
字号
package com.ora.jsp.sql;

import java.math.*;
import java.sql.*;

/**
 * This class represents a value used by the SQL tags. It contains
 * default implementations of get methods for all supported types,
 * to avoid casting when using a concrete implementation. All default
 * implementations throw an UnsupportedConversionException.
 *
 * Each subclass must override the getString() method, returning the
 * value as a String, plus the get method for the appropriate data
 * type, and provide a constructor to set the value.
 *
 * @author Hans Bergsten, Gefion software <hans@gefionsoftware.com>
 * @version 1.0
 */
public abstract class Value {

    public BigDecimal getBigDecimal() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to BigDecimal");
    }

    public boolean getBoolean() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to boolean");
    }

    public byte getByte() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to byte");
    }

    public byte[] getBytes() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to byte[]");
    }

    public Date getDate() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to Date");
    }

    public double getDouble() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to double");
    }

    public float getFloat() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to float");
    }

    public int getInt() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to int");
    }

    public long getLong() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to long");
    }

    public short getShort() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to short");
    }

    /**
     * This method must be implemented by all subclasses.
     * All data types can be converted to a String.
     */
    public abstract String getString();

    public Time getTime() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to Time");
    }

    public Timestamp getTimestamp() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to Timestamp");
    }

    public Object getObject() throws UnsupportedConversionException {
        throw new UnsupportedConversionException("No conversion to Object");
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?