/* 
 * $Header: /home/cvs/commons/dbutils-1.0/ja/src/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java,v 1.1.1.1 2004/02/13 10:02:04 hioki Exp $
 * $Revision: 1.1.1.1 $
 * $Date: 2004/02/13 10:02:04 $
 * 
 * ====================================================================
 * 
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2003 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution, if
 *    any, must include the following acknowledgement:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgement may appear in the software itself,
 *    if and wherever such third-party acknowledgements normally appear.
 *
 * 4. The names "The Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used to endorse or promote products derived
 *    from this software without prior written permission. For written
 *    permission, please contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache"
 *    nor may "Apache" appear in their names without prior written
 *    permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 */

package org.apache.commons.dbutils.wrappers;

import java.io.InputStream;
import java.io.Reader;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.dbutils.ProxyFactory;

/**
 * <code>ResultSet</code> の各 <code>getXXX</code> メソッドに SQL NULL 値の判定処理を追加します。
 * <code>getXXX</code>  メソッドによって SQL NULL でないカラム値が取得された場合、そのカラム値が返されます。
 *  一方、カラム値が SQL NULL であった場合には代替値が返されます。 
 * デフォルトの代替値は、当該クラスのインスタンスへオーバーライドすることが可能な Java の <code>null</code> 値です。 
 * {@primary Decorates a <code>ResultSet</code> with checks for a SQL NULL value on each
 * <code>getXXX</code> method. If a column value obtained by a 
 * <code>getXXX</code> method is not SQL NULL, the column value is returned. If
 * the column value is SQL null, an alternate value is returned. The alternate
 * value defaults to the Java <code>null</code> value, which can be overridden
 * for instances of the class.}
 * 
 * <p>
 * 役に立つ例題:
 * {@primary Usage example:}
 * <blockquote>
  * <pre>
 * Connection conn = // 接続を取得する
 * Statement stmt = conn.createStatement();
 * ResultSet rs = stmt.executeQuery("SELECT col1, col2 FROM table1");
 * 
 * // SQL NULLを判定する結果セットをラップする
 * SqlNullCheckedResultSet wrapper = new SqlNullCheckedResultSet(rs);
 * wrapper.setNullString("---N/A---"); // null文字列に対して設定する
 * wrapper.setNullInt(-999); // null 数値に対して設定する
 * rs = ProxyFactory.instance().createResultSet(wrapper);
 * 
 * while (rs.next()) {
 *     // col1 がSQL NULL の場合、"---N/A---" が値として返される
 *     String col1 = rs.getString("col1");
 *     // col2 がSQL NULL の場合、-999 が値として返される
 *     int col2 = rs.getInt("col2");
 * }
 * rs.close();
 * </pre>
 * {@primary <pre>
 * Connection conn = // somehow get a connection
 * Statement stmt = conn.createStatement();
 * ResultSet rs = stmt.executeQuery("SELECT col1, col2 FROM table1");
 * 
 * // Wrap the result set for SQL NULL checking
 * SqlNullCheckedResultSet wrapper = new SqlNullCheckedResultSet(rs);
 * wrapper.setNullString("---N/A---"); // Set null string
 * wrapper.setNullInt(-999); // Set null integer
 * rs = ProxyFactory.instance().createResultSet(wrapper);
 * 
 * while (rs.next()) {
 *     // If col1 is SQL NULL, value returned will be "---N/A---"
 *     String col1 = rs.getString("col1");
 *     // If col2 is SQL NULL, value returned will be -999
 *     int col2 = rs.getInt("col2");
 * }
 * rs.close();
 * </pre>}
 * </blockquote>
 * </p>
 *
 * @author  <a href="stevencaswell@apache.org">Steven Caswell</a>
 * @author David Graham
 * @translator 小川 環
 * @editor 日置 聡
 * @status underproof
 * @update 2003/12/22
 * @version $Id: SqlNullCheckedResultSet.java,v 1.1.1.1 2004/02/13 10:02:04 hioki Exp $
 */
public class SqlNullCheckedResultSet implements InvocationHandler {

    /**
     * Maps normal method names (ie. "getBigDecimal") to the corresponding null
     * Method object (ie. getNullBigDecimal).
     */
    private static final Map nullMethods = new HashMap();

    static {
        Method[] methods = SqlNullCheckedResultSet.class.getMethods();
        for (int i = 0; i < methods.length; i++) {
            String methodName = methods[i].getName();

            if (methodName.startsWith("getNull")) {
                String normalName = "get" + methodName.substring(7);
                nullMethods.put(normalName, methods[i]);
            }
        }
    }

    /**
     * The factory to create proxies with.
     */
    private static final ProxyFactory factory = ProxyFactory.instance();

    /**
     * このクラスのインスタンスに <code>ResultSet</code> をラップします。 これは、次のコードと等しいです。
     * {@primary Wraps the <code>ResultSet</code> in an instance of this class.  This is
     * equivalent to:}
     * <pre>
     * ProxyFactory.instance().createResultSet(new SqlNullCheckedResultSet(rs));
     * </pre>
     * 
     * @param rs ラップする <code>ResultSet</code>。
     * {@primary The <code>ResultSet</code> to wrap.}
     */
    public static ResultSet wrap(ResultSet rs) {
        return factory.createResultSet(new SqlNullCheckedResultSet(rs));
    }

    private InputStream nullAsciiStream = null;
    private BigDecimal nullBigDecimal = null;
    private InputStream nullBinaryStream = null;
    private Blob nullBlob = null;
    private boolean nullBoolean = false;
    private byte nullByte = 0;
    private byte[] nullBytes = null;
    private Reader nullCharacterStream = null;
    private Clob nullClob = null;
    private Date nullDate = null;
    private double nullDouble = 0.0;
    private float nullFloat = 0.0f;
    private int nullInt = 0;
    private long nullLong = 0;
    private Object nullObject = null;
    private Ref nullRef = null;
    private short nullShort = 0;
    private String nullString = null;
    private Time nullTime = null;
    private Timestamp nullTimestamp = null;
    private URL nullURL = null;

    /**
     * The wrapped result. 
     */
    private final ResultSet rs;

    /**
     * 指定された <code>ResultSet</code> をラップした <code>SqlNullCheckedResultSet</code>
     * の新規インスタンスを作成します。
     * {@primary Constructs a new instance of
     * <code>SqlNullCheckedResultSet</code>
     * to wrap the specified <code>ResultSet</code>.}
     */
    public SqlNullCheckedResultSet(ResultSet rs) {
        super();
        this.rs = rs;
    }

    /**
     * <code>getAsciiStream</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getAsciiStream</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public InputStream getNullAsciiStream() {
        return this.nullAsciiStream;
    }

    /**
     * <code>getBigDecimal</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getBigDecimal</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public BigDecimal getNullBigDecimal() {
        return this.nullBigDecimal;
    }

    /**
     * <code>getBinaryStream</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getBinaryStream</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public InputStream getNullBinaryStream() {
        return this.nullBinaryStream;
    }

    /**
     * <code>getBlob</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getBlob</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public Blob getNullBlob() {
        return this.nullBlob;
    }

    /**
     * <code>getBoolean</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     *{@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getBoolean</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public boolean getNullBoolean() {
        return this.nullBoolean;
    }

    /**
     * <code>getByte</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getByte</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public byte getNullByte() {
        return this.nullByte;
    }

    /**
     * <code>getBytes</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getBytes</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public byte[] getNullBytes() {
        return this.nullBytes;
    }

    /**
     * <code>getCharacterStream</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getCharacterStream</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public Reader getNullCharacterStream() {
        return this.nullCharacterStream;
    }

    /**
     * <code>getClob</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getClob</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public Clob getNullClob() {
        return this.nullClob;
    }

    /**
     * <code>getDate</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getDate</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public Date getNullDate() {
        return this.nullDate;
    }

    /**
     * <code>getDouble</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getDouble</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public double getNullDouble() {
        return this.nullDouble;
    }

    /**
     * <code>getFloat</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getFloat</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public float getNullFloat() {
        return this.nullFloat;
    }

    /**
     * <code>getInt</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getInt</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public int getNullInt() {
        return this.nullInt;
    }

    /**
     * <code>getLong</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getLong</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public long getNullLong() {
        return this.nullLong;
    }

    /**
     * <code>getObject</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getObject</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public Object getNullObject() {
        return this.nullObject;
    }

    /**
     * <code>getRef</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getRef</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public Ref getNullRef() {
        return this.nullRef;
    }

    /**
     * <code>getShort</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getShort</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public short getNullShort() {
        return this.nullShort;
    }

    /**
     * <code>getString</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getString</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public String getNullString() {
        return this.nullString;
    }

    /**
     * <code>getTime</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getTime</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public Time getNullTime() {
        return this.nullTime;
    }

    /**
     * <code>getTimestamp</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getTimestamp</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public Timestamp getNullTimestamp() {
        return this.nullTimestamp;
    }

    /**
     * <code>getURL</code> メソッドの処理結果が SQL NULL だった場合に使用する値を返します。
     * {@primary Returns the value when a SQL null is encountered as the result of
     * invoking a <code>getURL</code> method.}
     *
     * @return ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public URL getNullURL() {
        return this.nullURL;
    }

    /**
     * <code>get*</code> メソッドの呼び出しを捕捉し、<code>ResultSet</code> が
     * <code>null</code> を返す場合、適切な <code>getNull*</code> メソッドを呼び出します。
     * {@primary Intercepts calls to <code>get*</code> methods and calls the appropriate
     * <code>getNull*</code> method if the <code>ResultSet</code> returned
     * <code>null</code>.}
     * 
     * @throws Throwable
     * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
     */
    public Object invoke(Object proxy, Method method, Object[] args)
        throws Throwable {

        Object result = method.invoke(this.rs, args);

        Method nullMethod = (Method) nullMethods.get(method.getName());

        // Check nullMethod != null first so that we don't call wasNull()
        // before a true getter method was invoked on the ResultSet.
        return (nullMethod != null && this.rs.wasNull())
            ? nullMethod.invoke(this, null)
            : result;
    }

    /**
     * <code>getAsciiStream</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getAsciiStream</code> method.}
     *
     * @param nullAsciiStream ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullAsciiStream(InputStream nullAsciiStream) {
        this.nullAsciiStream = nullAsciiStream;
    }

    /**
     * <code>getBigDecimal</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getBigDecimal</code> method.}
     *
     * @param nullBigDecimal ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullBigDecimal(BigDecimal nullBigDecimal) {
        this.nullBigDecimal = nullBigDecimal;
    }

    /**
     * <code>getBinaryStream</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getBinaryStream</code> method.}
     *
     * @param nullBinaryStream ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullBinaryStream(InputStream nullBinaryStream) {
        this.nullBinaryStream = nullBinaryStream;
    }

    /**
     * <code>getBlob</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getBlob</code> method.}
     *
     * @param nullBlob ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullBlob(Blob nullBlob) {
        this.nullBlob = nullBlob;
    }

    /**
     * <code>getBoolean</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getBoolean</code> method.}
     *
     * @param nullBoolean ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullBoolean(boolean nullBoolean) {
        this.nullBoolean = nullBoolean;
    }

    /**
     * <code>getByte</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getByte</code> method.}
     *
     * @param nullByte ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullByte(byte nullByte) {
        this.nullByte = nullByte;
    }

    /**
     * <code>getBytes</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getBytes</code> method.}
     *
     * @param nullBytes ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullBytes(byte[] nullBytes) {
        this.nullBytes = nullBytes;
    }

    /**
     * <code>getCharacterStream</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getCharacterStream</code> method.}
     *
     * @param nullCharacterStream ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullCharacterStream(Reader nullCharacterStream) {
        this.nullCharacterStream = nullCharacterStream;
    }

    /**
     * <code>getClob</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getClob</code> method.}
     *
     * @param nullClob ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullClob(Clob nullClob) {
        this.nullClob = nullClob;
    }

    /**
     * <code>getDate</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getDate</code> method.}
     *
     * @param nullDate ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullDate(Date nullDate) {
        this.nullDate = nullDate;
    }

    /**
     * <code>getDouble</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getDouble</code> method.}
     *
     * @param nullDouble ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullDouble(double nullDouble) {
        this.nullDouble = nullDouble;
    }

    /**
     * <code>getFloat</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getFloat</code> method.}
     *
     * @param nullFloat ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullFloat(float nullFloat) {
        this.nullFloat = nullFloat;
    }

    /**
     * <code>getInt</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getInt</code> method.}
     *
     * @param nullInt ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullInt(int nullInt) {
        this.nullInt = nullInt;
    }

    /**
     * <code>getLong</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getLong</code> method.}
     *
     * @param nullLong ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullLong(long nullLong) {
        this.nullLong = nullLong;
    }

    /**
     * <code>getObject</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getObject</code> method.}
     *
     * @param nullObject ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullObject(Object nullObject) {
        this.nullObject = nullObject;
    }

    /**
     * <code>getRef</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getRef</code> method.}
     *
     * @param nullRef ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullRef(Ref nullRef) {
        this.nullRef = nullRef;
    }

    /**
     * <code>getShort</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getShort</code> method.}
     *
     * @param nullShort ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullShort(short nullShort) {
        this.nullShort = nullShort;
    }

    /**
     * <code>getString</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getString</code> method.}
     *
     * @param nullString ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullString(String nullString) {
        this.nullString = nullString;
    }

    /**
     * <code>getTime</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getTime</code> method.}
     *
     * @param nullTime ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullTime(Time nullTime) {
        this.nullTime = nullTime;
    }

    /**
     * <code>getTimestamp</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getTimestamp</code> method.}
     *
     * @param nullTimestamp ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullTimestamp(Timestamp nullTimestamp) {
        this.nullTimestamp = nullTimestamp;
    }

    /**
     * <code>getURL</code> メソッドの処理結果が SQL NULL だった場合に使用する値を設定します。
     * {@primary Sets the value to return when a SQL null is encountered as the result of
     * invoking a <code>getURL</code> method.}
     *
     * @param nullURL ( SQL null の代わりに返す)値
     * {@primary the value}
     */
    public void setNullURL(URL nullURL) {
        this.nullURL = nullURL;
    }

}
