public final class DateRegister extends Object implements ScalarRegister, DateSettable
DateValued
object.Constructor and Description |
---|
DateRegister()
Creates a new null-valued register.
|
Modifier and Type | Method and Description |
---|---|
CalendarDate |
asCalendarDate()
Gets the contained date value.
|
Date |
asDate()
Gets the contained date value as a
java.sql.Date
relative to the default time zone. |
Date |
asDate(TimeZone tz)
Gets the contained date value as a
java.sql.Date
relative to the given time zone. |
long |
asEpochDays()
Gets the contained date value as the number of days since
Java epoch (January 1, 1970).
|
ScalarTokenType |
getType()
Gets the data type of the token.
|
boolean |
isNull()
Indicates whether the token is null valued.
|
boolean |
isZero()
Indicates whether the value is the zero value
for the type.
|
void |
set(CalendarDate date)
Sets the container to the specified calendar date.
|
void |
set(Date date)
Sets the container to a date value specified as a
java.util.Date object, relative to the default time zone. |
void |
set(Date date,
TimeZone tz)
Sets the container to a date value specified as a
java.util.Date object, relative to the given time zone. |
void |
set(long days)
Sets the container to a date value specified as the number of days
since Java epoch (January 1, 1970 GMT).
|
void |
set(TokenValued value)
Sets the contained value to the given token value.
|
void |
setNull()
Sets the contained value to be null valued.
|
void |
setZero()
Sets the contained value to be zero valued.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getType, isZero
isNull
public void setNull()
TokenSettable
setNull
in interface TokenSettable
public void setZero()
TokenSettable
setZero
in interface TokenSettable
public void set(Date date)
DateSettable
java.util.Date
object, relative to the default time zone.
The time zone returned by TimeZone.getDefault()
is used.set
in interface DateSettable
date
- date value to which to set the container, expressed as a
point in time relative to the default time zonepublic void set(Date date, TimeZone tz)
DateSettable
java.util.Date
object, relative to the given time zone.set
in interface DateSettable
date
- date value to which to set the container, expressed as a
point in time relative to the specified time zonetz
- the time zone in which the date should be interpretedpublic void set(long days)
DateSettable
set
in interface DateSettable
days
- date value to which to set the container, expressed as the
number of days since Java epochpublic void set(CalendarDate date)
DateSettable
set
in interface DateSettable
date
- value to which to set the containerpublic void set(TokenValued value)
TokenSettable
set
in interface TokenSettable
value
- the value to which to set the containerpublic final ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public final long asEpochDays()
DateValued
asEpochDays
in interface DateValued
TokenValued.isNull()
,
0
is returned.public final Date asDate()
DateValued
java.sql.Date
relative to the default time zone. The time zone used by
TimeZone.getDefault()
is used.asDate
in interface DateValued
java.sql.Date
.
If null valued, as indicated by TokenValued.isNull()
,
null
is returned.public final Date asDate(TimeZone tz)
DateValued
java.sql.Date
relative to the given time zone.asDate
in interface DateValued
tz
- the time zone in which to interpret the datejava.sql.Date
.
If null valued, as indicated by TokenValued.isNull()
,
null
is returned.public final CalendarDate asCalendarDate()
DateValued
asCalendarDate
in interface DateValued
TokenValued.isNull()
,
null
is returned.public final boolean isZero()
ScalarValued
isZero
in interface ScalarValued
true
if the value is the zero value,
false
otherwise.public final boolean isNull()
TokenValued
isNull
in interface TokenValued
true
if the token is null valued,
false
otherwiseCopyright © 2021 Actian Corporation. All rights reserved.