com.davisor.data
Class DateData

java.lang.Object
  extended byjava.util.Date
      extended bycom.davisor.data.TimestampData
          extended bycom.davisor.data.DateData
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, Data, DataValue, com.davisor.core.Dupable, java.io.Serializable, SerializableData

public class DateData
extends TimestampData

DateData represents a date, as opposed to time values that represent the time of day and timestamps that represent them both.

Since:
JDK1.1
See Also:
setTime(long), DateType, Serialized Form

Field Summary
 
Fields inherited from class com.davisor.data.TimestampData
M_type, NaT
 
Constructor Summary
DateData()
          Create a new date data object with the current date and default type.
DateData(DateData data, boolean deep)
          Deep or shallow copy constructor.
DateData(DateFormatType type)
          Create a new date data object with the current date and given type.
DateData(DateFormatType type, java.util.Date value)
          Create a new date data object with the given type and value.
DateData(DateFormatType type, long milliseconds)
          Create a new date data object with the given type and value.
DateData(DateFormatType type, java.lang.String stringValue, java.text.ParsePosition status)
          Creates a date data value from a string value.
 
Method Summary
 com.davisor.core.Dupable dup()
          Makes a deep copy of this object.
 void setTime(long milliseconds)
          Sets the current date value, but enforcing dates over time by stripping all the time of day information from the given timestamp value.
 void toStatement(java.sql.PreparedStatement statement, int parameter)
          Convert data to a prepared statement input parameter.
 
Methods inherited from class com.davisor.data.TimestampData
abs, add, ceil, ceil, compareTo, compareTo, createCalendar, deinterpolate, div, floor, floor, getFormat, getType, initTime, interpolate, isNull, max, min, mul, negate, setTime, setValue, sub, toString, toXML, unit
 
Methods inherited from class java.util.Date
after, before, clone, compareTo, equals, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setYear, toGMTString, toLocaleString, UTC
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateData

public DateData()
Create a new date data object with the current date and default type.


DateData

public DateData(DateData data,
                boolean deep)
Deep or shallow copy constructor. If it is shallow, then the new object shares an underlying type with the original object. If it is deep, then the type is dupped.

Parameters:
data - source data (may be null)
deep - determine if the copying is deep or shallow
See Also:
TimestampData.getType(), Type.dup()

DateData

public DateData(DateFormatType type)
Create a new date data object with the current date and given type.

Parameters:
type - date type

DateData

public DateData(DateFormatType type,
                java.util.Date value)
Create a new date data object with the given type and value.

Parameters:
type - date type
value - date value (may be null)
See Also:
DateData(DateFormatType,long)

DateData

public DateData(DateFormatType type,
                long milliseconds)
Create a new date data object with the given type and value. The given milliseconds value is interpreted as a calendar date, from which all the time fields are then cleared away. The resulting milliseconds value represents the moment the spesified day begins.

Parameters:
type - date type
milliseconds - date value
See Also:
DateData(DateFormatType,java.util.Date), TimestampData.initTime(com.davisor.data.DateFormatType, long)

DateData

public DateData(DateFormatType type,
                java.lang.String stringValue,
                java.text.ParsePosition status)
         throws InvalidDataException
Creates a date data value from a string value.

Parameters:
stringValue - string value to be parsed
status - parse status (may be null)
Throws:
InvalidDataException - if string value could not be parser
See Also:
TimestampData.setValue(String,ParsePosition)
Method Detail

toStatement

public void toStatement(java.sql.PreparedStatement statement,
                        int parameter)
                 throws java.sql.SQLException
Convert data to a prepared statement input parameter.

Specified by:
toStatement in interface DataValue
Overrides:
toStatement in class TimestampData
Throws:
java.sql.SQLException - if a SQL error occurs.

setTime

public void setTime(long milliseconds)
Sets the current date value, but enforcing dates over time by stripping all the time of day information from the given timestamp value.

Parameters:
milliseconds - date time value
See Also:
TimestampData.initTime(com.davisor.data.DateFormatType, long), TimeData.setTime(long)

dup

public com.davisor.core.Dupable dup()
Makes a deep copy of this object.

Specified by:
dup in interface com.davisor.core.Dupable
Overrides:
dup in class TimestampData


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.