com.workingdogs.village
Class Value

java.lang.Object
  extended bycom.workingdogs.village.Value

public class Value
extends java.lang.Object

A Value represents a single cell in a database table. In other words, it is the cross between a row and column and contains the information held there.

Version:
$Revision: 1.15 $
Author:
Jon S. Stevens jon@latchkey.com

Field Summary
private  int columnNumber
          the column number that this object came from
private  int type
          what sql type of object is this?
private  java.lang.Object valueObject
          the object that is stored in this object
 
Constructor Summary
Value(java.sql.ResultSet rs, int columnNumber, int type)
          Creates a new Value object based on the ResultSet, columnNumber and type
 
Method Summary
 java.math.BigDecimal asBigDecimal()
          Get the value as a BigDecimal
 java.math.BigDecimal asBigDecimal(int scale)
          Get the value as a BigDecimal
 boolean asBoolean()
          Get the value as a asBoolean
 byte asByte()
          Get the value as a asByte
 java.lang.Byte asByteObj()
          Get the value as a Byte Object
 byte[] asBytes()
          Get the value as a asBytes
 java.sql.Date asDate()
          Get the value as a asDate
 double asDouble()
          Get the value as a asDouble
 java.lang.Double asDoubleObj()
          Get the value as a Double Object
 float asFloat()
          Get the value as a asFloat
 java.lang.Float asFloatObj()
          Get the value as a Float Obj
 int asInt()
          Get the value as a asInt
 java.lang.Integer asIntegerObj()
          Get the value as a Integer Ojbect
 long asLong()
          Get the value as a asLong
 java.lang.Long asLongObj()
          Get the value as a Long Object
 short asShort()
          Get the value as a asShort
 java.lang.Short asShortObj()
          Get the value as a Short Object
 java.lang.String asString()
          Returns the string representation of this object
 java.sql.Time asTime()
          Get the value as a asTime
 java.sql.Timestamp asTimestamp()
          Get the value as a asTimestamp
 java.util.Date asUtilDate()
          Get the value as a asUtilDate
(package private)  int columnNumber()
          Gets the columnNumber which this value represents.
(package private)  java.lang.Object getValue()
          Gets the object from this Value
 boolean isBigDecimal()
          Is the value a isBigDecimal
 boolean isBoolean()
          Is the value a isBoolean
 boolean isByte()
          Is the value a isByte
 boolean isBytes()
          Is the value a isBytes
 boolean isDate()
          Is the value a isDate
 boolean isDouble()
          Is the value a isDouble
 boolean isFloat()
          Is the value a isFloat
 boolean isInt()
          Is the value a isInt
 boolean isLong()
          Is the value a isLong
 boolean isNull()
          Is the value a isNull
 boolean isShort()
          Is the value a isShort
 boolean isString()
          Is the value a isString
 boolean isTime()
          Is the value a isTime
 boolean isTimestamp()
          Is the value a isTimestamp
private  boolean isTrue(java.lang.String value)
           
 boolean isUtilDate()
          Is the value a isUtilDate
(package private)  void setPreparedStatementValue(java.sql.PreparedStatement stmt, int stmtNumber)
          This is used in Record in order to do a saveWithInsert/Update/Delete
(package private)  void setValue(java.lang.Object value)
          Sets the value of this object
 java.lang.String toString()
          Returns the string representation of this object
 int type()
          Return the type of this value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

valueObject

private java.lang.Object valueObject
the object that is stored in this object


columnNumber

private int columnNumber
the column number that this object came from


type

private int type
what sql type of object is this?

Constructor Detail

Value

public Value(java.sql.ResultSet rs,
             int columnNumber,
             int type)
      throws java.sql.SQLException
Creates a new Value object based on the ResultSet, columnNumber and type

Parameters:
rs -
columnNumber -
type -
Throws:
java.sql.SQLException
Method Detail

setValue

void setValue(java.lang.Object value)
Sets the value of this object

Parameters:
value -

getValue

java.lang.Object getValue()
Gets the object from this Value

Returns:
the object from this Value

setPreparedStatementValue

void setPreparedStatementValue(java.sql.PreparedStatement stmt,
                               int stmtNumber)
                         throws DataSetException,
                                java.sql.SQLException
This is used in Record in order to do a saveWithInsert/Update/Delete

Parameters:
stmt -
stmtNumber -
Throws:
DataSetException
java.sql.SQLException

toString

public java.lang.String toString()
Returns the string representation of this object

Returns:
a string

asString

public java.lang.String asString()
Returns the string representation of this object

Returns:
a string

asBigDecimal

public java.math.BigDecimal asBigDecimal()
                                  throws DataSetException
Get the value as a BigDecimal

Returns:
a BigDecimal
Throws:
DataSetException

asBigDecimal

public java.math.BigDecimal asBigDecimal(int scale)
                                  throws DataSetException
Get the value as a BigDecimal

Returns:
a BigDecimal
Throws:
DataSetException

asBoolean

public boolean asBoolean()
                  throws DataSetException
Get the value as a asBoolean

Returns:
a boolean
Throws:
DataSetException

asInt

public int asInt()
          throws DataSetException
Get the value as a asInt

Returns:
an int
Throws:
DataSetException

asIntegerObj

public java.lang.Integer asIntegerObj()
                               throws DataSetException
Get the value as a Integer Ojbect

Returns:
an Integer
Throws:
DataSetException

asByte

public byte asByte()
            throws DataSetException
Get the value as a asByte

Returns:
a byte
Throws:
DataSetException

asByteObj

public java.lang.Byte asByteObj()
                         throws DataSetException
Get the value as a Byte Object

Returns:
a Byte
Throws:
DataSetException

asBytes

public byte[] asBytes()
               throws DataSetException
Get the value as a asBytes

Returns:
a byte array
Throws:
DataSetException

asShort

public short asShort()
              throws DataSetException
Get the value as a asShort

Returns:
a short
Throws:
DataSetException

asShortObj

public java.lang.Short asShortObj()
                           throws DataSetException
Get the value as a Short Object

Returns:
a Short
Throws:
DataSetException

asLong

public long asLong()
            throws DataSetException
Get the value as a asLong

Returns:
a long
Throws:
DataSetException

asLongObj

public java.lang.Long asLongObj()
                         throws DataSetException
Get the value as a Long Object

Returns:
a Long
Throws:
DataSetException

asDouble

public double asDouble()
                throws DataSetException
Get the value as a asDouble

Returns:
a double
Throws:
DataSetException

asDoubleObj

public java.lang.Double asDoubleObj()
                             throws DataSetException
Get the value as a Double Object

Returns:
a Double
Throws:
DataSetException

asFloat

public float asFloat()
              throws DataSetException
Get the value as a asFloat

Returns:
a float
Throws:
DataSetException

asFloatObj

public java.lang.Float asFloatObj()
                           throws DataSetException
Get the value as a Float Obj

Returns:
a Float
Throws:
DataSetException

asTime

public java.sql.Time asTime()
                     throws DataSetException
Get the value as a asTime

Returns:
a Time
Throws:
DataSetException

asTimestamp

public java.sql.Timestamp asTimestamp()
                               throws DataSetException
Get the value as a asTimestamp

Returns:
a Timestamp
Throws:
DataSetException

asDate

public java.sql.Date asDate()
                     throws DataSetException
Get the value as a asDate

Returns:
a java.sql.Date
Throws:
DataSetException

asUtilDate

public java.util.Date asUtilDate()
                          throws DataSetException
Get the value as a asUtilDate

Returns:
a java.util.Date
Throws:
DataSetException

isBigDecimal

public boolean isBigDecimal()
Is the value a isBigDecimal

Returns:
true if BigDecimal

isByte

public boolean isByte()
Is the value a isByte

Returns:
true if is Byte

isBytes

public boolean isBytes()
Is the value a isBytes

Returns:
true if is byte[]

isDate

public boolean isDate()
Is the value a isDate

Returns:
true if is java.sql.Date

isShort

public boolean isShort()
Is the value a isShort

Returns:
true if is Short

isInt

public boolean isInt()
Is the value a isInt

Returns:
true if is Integer

isLong

public boolean isLong()
Is the value a isLong

Returns:
true if is Long

isDouble

public boolean isDouble()
Is the value a isDouble

Returns:
true if is Double

isFloat

public boolean isFloat()
Is the value a isFloat

Returns:
true if is Float

isBoolean

public boolean isBoolean()
Is the value a isBoolean

Returns:
true if is Boolean

isNull

public boolean isNull()
Is the value a isNull

Returns:
true if is null

isString

public boolean isString()
Is the value a isString

Returns:
true if is String

isTime

public boolean isTime()
Is the value a isTime

Returns:
true if is java.sql.Time

isTimestamp

public boolean isTimestamp()
Is the value a isTimestamp

Returns:
true if is java.sql.Timestamp

isUtilDate

public boolean isUtilDate()
Is the value a isUtilDate

Returns:
true if is java.util.Date

type

public int type()
Return the type of this value

Returns:
the type of this value

columnNumber

int columnNumber()
Gets the columnNumber which this value represents.

Returns:
an int

isTrue

private boolean isTrue(java.lang.String value)
Returns:
true if (true || t | yes | 1)


Copyright © 1999-2002 Share.Whichever.com All Rights Reserved.