jet.connect
Class DbDate

java.lang.Object
  extended by jet.connect.DbValue
      extended by jet.connect.DbDateTime
          extended by jet.connect.DbDate
All Implemented Interfaces:
jet.util.DbValueable, jet.util.QuickSortableNode

public class DbDate
extends DbDateTime

The DbDate class wraps a value of primitive type long in an object. An object of the type DbDate contains a single field whose type is long.

In addition, this class provides several methods for the interconversion of a DbDate and a String, as well as other constants and methods used when dealing with a DbDate.


Field Summary
 
Fields inherited from class jet.connect.DbDateTime
value
 
Fields inherited from class jet.connect.DbValue
bNull, CHAR_DESC, CURRENCY_DESC, DATE_DESC, desc, DOUBLE_DESC, INTEGER_DESC, TIME_DESC
 
Fields inherited from interface jet.util.DbValueable
EQUAL, GREATER, LESS
 
Constructor Summary
DbDate()
          Constructs an uninitialized DbDate.
DbDate(java.sql.Date dt)
          Constructs an uninitialized DbDate.
DbDate(DbColDesc desc)
          Constructs an uninitialized DbDate.
 
Method Summary
 java.lang.Object clone()
          Creates a clone of this DbDate object.
 java.sql.Date getDate()
          Returns a java.sql.Date object using the milliseconds time value.
 void set(JRHierarchicalDataset hds, int col)
          Sets a newly allocated DbDate object that represents the long value indicated by the JRHierarchicalDataset parameter and an index of the column.
 void set(java.sql.ResultSet rs, int col)
          Sets a newly allocated DbDate object that represents the long value indicated by the ResultSet parameter and an index of the column.
 void setDate(java.sql.Date v)
          Sets an existing Date object using the given milliseconds date value.
 void setValue(java.lang.String v)
          Sets a newly allocated DbDate object that represents the String value indicated by the String parameter.
 java.lang.String toString()
          Returns a String object representing this DbDate's value.
 
Methods inherited from class jet.connect.DbDateTime
compareTo, equals, get, set, set, toFormatString, toSqlDate, toStringValue, toUtilDate
 
Methods inherited from class jet.connect.DbValue
compareTo, compareTo, equals, getColDesc, getPrecision, getScale, getSqlType, isCurrency, isNull, makeDbValue, setColDesc, setfoo, setNull, setValue
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DbDate

public DbDate()
Constructs an uninitialized DbDate. This DbDate object is mutable until the value and the description of the column are set.


DbDate

public DbDate(java.sql.Date dt)
Constructs an uninitialized DbDate. This DbDate object is mutable until DbColDesc is set.

Parameters:
dt - The value holding a java.sql.Date object.

DbDate

public DbDate(DbColDesc desc)
Constructs an uninitialized DbDate. This DbDate object is mutable until the value is set.

Parameters:
desc - The value to be represented by the DbColDesc object.
Method Detail

getDate

public final java.sql.Date getDate()
Returns a java.sql.Date object using the milliseconds time value. If the milliseconds value contains time information, this method will return the time component to the time in the default time zone (the time zone of the Java virtual machine running the application) that corresponds to zero GMT.


setDate

public final void setDate(java.sql.Date v)
Sets an existing Date object using the given milliseconds date value. It uses Date.getTime() to retrieve value.

Parameters:
v - The valid date value.

set

public void set(java.sql.ResultSet rs,
                int col)
         throws java.sql.SQLException
Sets a newly allocated DbDate object that represents the long value indicated by the ResultSet parameter and an index of the column.

Specified by:
set in class DbValue
Parameters:
rs - The ResultSet to be fetched.
col - The index of the column.
Throws:
java.sql.SQLException - if the ResultSet does not contain the index.

set

public void set(JRHierarchicalDataset hds,
                int col)
         throws java.sql.SQLException
Sets a newly allocated DbDate object that represents the long value indicated by the JRHierarchicalDataset parameter and an index of the column.

Overrides:
set in class DbValue
Parameters:
hds - The JRHierarchicalDataset to be fetched.
col - The index of the column.
Throws:
java.sql.SQLException - if the ResultSet does not contain the index.

toString

public java.lang.String toString()
Returns a String object representing this DbDate's value. The value is returned as a string. If the value is null, it returns "NULL".

Specified by:
toString in class DbValue
Returns:
a string representation of the value of this object.

clone

public java.lang.Object clone()
Creates a clone of this DbDate object.

Specified by:
clone in interface jet.util.DbValueable
Specified by:
clone in class DbValue

setValue

public void setValue(java.lang.String v)
Sets a newly allocated DbDate object that represents the String value indicated by the String parameter.

Specified by:
setValue in class DbValue
Parameters:
v - The String to be converted to a DbDate. The String object represents a date in the format "yyyy-[m]m-[d]d". The leading zero for mm and dd may also be omitted.