org.eigenbase.util14
Class ZonelessDatetime

java.lang.Object
  extended by org.eigenbase.util14.ZonelessDatetime
All Implemented Interfaces:
Serializable, BasicDatetime
Direct Known Subclasses:
ZonelessDate, ZonelessTime, ZonelessTimestamp

public abstract class ZonelessDatetime
extends Object
implements BasicDatetime, Serializable

ZonelessDatetime is an abstract class for dates, times, or timestamps that contain a zoneless time value.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/util14/ZonelessDatetime.java#7 $
Author:
John Pham
See Also:
Serialized Form

Field Summary
 long internalTime
          Treat this as a protected field.
protected  String lastFormat
           
private static long serialVersionUID
          SerialVersionUID created with JDK 1.5 serialver tool.
protected  Calendar tempCal
           
protected  DateFormat tempFormatter
           
 
Constructor Summary
ZonelessDatetime()
           
 
Method Summary
 void clearDate()
          Clears the date component of this datetime
 void clearTime()
          Clears the time component of this datetime
protected  Calendar getCalendar(TimeZone zone)
          Gets a temporary Calendar set to the specified time zone.
 long getDateValue()
          Gets the date portion of this zoneless datetime.
protected  DateFormat getFormatter(String format)
          Gets a temporary formatter for a zoneless date time.
 long getJdbcDate(TimeZone zone)
          Gets the value of this datetime as a milliseconds value for Date.
 long getJdbcTime(TimeZone zone)
          Gets the value of this datetime as a milliseconds value for Time.
 long getJdbcTimestamp(TimeZone zone)
          Gets the value of this datetime as a milliseconds value for Timestamp.
 long getTime()
          Gets the internal value of this datetime
 long getTimeValue()
          Gets the time portion of this zoneless datetime.
 void setZonedTime(long value, TimeZone zone)
          Sets this datetime via a zoned time value.
 void setZonelessTime(long value)
          Sets this datetime via a zoneless time value.
abstract  Object toJdbcObject()
          Returns this datetime as a Jdbc object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
SerialVersionUID created with JDK 1.5 serialver tool.

See Also:
Constant Field Values

internalTime

public long internalTime
Treat this as a protected field. It is only made public to simplify Java code generation.


tempCal

protected transient Calendar tempCal

tempFormatter

protected transient DateFormat tempFormatter

lastFormat

protected transient String lastFormat
Constructor Detail

ZonelessDatetime

public ZonelessDatetime()
Method Detail

getTime

public long getTime()
Description copied from interface: BasicDatetime
Gets the internal value of this datetime

Specified by:
getTime in interface BasicDatetime

setZonelessTime

public void setZonelessTime(long value)
Description copied from interface: BasicDatetime
Sets this datetime via a zoneless time value. See class comments for more information.

Specified by:
setZonelessTime in interface BasicDatetime

setZonedTime

public void setZonedTime(long value,
                         TimeZone zone)
Description copied from interface: BasicDatetime
Sets this datetime via a zoned time value. See class comments for more information.

Specified by:
setZonedTime in interface BasicDatetime

getTimeValue

public long getTimeValue()
Gets the time portion of this zoneless datetime.


getDateValue

public long getDateValue()
Gets the date portion of this zoneless datetime.


clearDate

public void clearDate()
Clears the date component of this datetime


clearTime

public void clearTime()
Clears the time component of this datetime


getJdbcTime

public long getJdbcTime(TimeZone zone)
Gets the value of this datetime as a milliseconds value for Time.

Parameters:
zone - time zone in which to generate a time value for

getJdbcDate

public long getJdbcDate(TimeZone zone)
Gets the value of this datetime as a milliseconds value for Date.

Parameters:
zone - time zone in which to generate a time value for

getJdbcTimestamp

public long getJdbcTimestamp(TimeZone zone)
Gets the value of this datetime as a milliseconds value for Timestamp.

Parameters:
zone - time zone in which to generate a time value for

toJdbcObject

public abstract Object toJdbcObject()
Returns this datetime as a Jdbc object


getCalendar

protected Calendar getCalendar(TimeZone zone)
Gets a temporary Calendar set to the specified time zone. The same Calendar is returned on subsequent calls.


getFormatter

protected DateFormat getFormatter(String format)
Gets a temporary formatter for a zoneless date time. The same formatter is returned on subsequent calls.

Parameters:
format - a SimpleDateFormat format string