public final class DateToken extends Object implements ScalarToken, Comparable<DateToken>
DateValued object.| Modifier and Type | Field and Description |
|---|---|
static DateToken |
NULL
A null valued
DateToken |
static DateToken |
ZERO
A zero valued
DateToken |
static long |
ZERO_VALUE
The date representing a zero value, the beginning of Java epoch January 1, 1970.
|
| Constructor and Description |
|---|
DateToken(CalendarDate date)
Constructs a new token with the non-null calendar date.
|
DateToken(Date date)
Deprecated.
since 6.1
|
DateToken(Date date,
TimeZone tz)
Deprecated.
|
DateToken(DateValued value)
Constructs a new token with the date
value in the given container.
|
DateToken(int year,
int monthOfYear,
int dayOfMonth)
Constructs a new token with the non-null calendar date.
|
DateToken(long epochDays)
Constructs a new token with the non-null date value
specified as the number of days since Java epoch (January 1, 1970 GMT).
|
| 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).
|
int |
compareTo(DateToken that) |
boolean |
equals(Object obj)
Indicates whether another object is equal to this token.
|
ScalarTokenType |
getType()
Gets the data type of the token.
|
int |
hashCode()
Returns a hash code for the token.
|
boolean |
isNull()
Indicates whether the token is null valued.
|
boolean |
isZero()
Indicates whether the value is the zero value
for the type.
|
static DateToken |
parse(String value)
Converts a string representation of a date value into
a token.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetType, isZeroisNullpublic static final DateToken NULL
DateTokenpublic static final long ZERO_VALUE
public static final DateToken ZERO
DateTokenpublic DateToken(DateValued value)
value - a DateValued containing the
desired valuepublic DateToken(long epochDays)
NULL.epochDays - the date value of the token, expressed as the
number of days since Java epochpublic DateToken(int year,
int monthOfYear,
int dayOfMonth)
NULL.year - the year portion of the calendar datemonthOfYear - the month portion of the calendar date. Months
start from 1, unlike java.util.Calendar.dayOfMonth - the day portion of the calendar date.public DateToken(CalendarDate date)
NULL.date - the calendar date of the token@Deprecated public DateToken(Date date)
java.util.Date object. The date
is interpreted relative to the default time zone as returned
by TimeZone.getDefault().
If a null valued token is desired, use NULL.date - the date value of the token, expressed as a
point in time relative to the default time zone@Deprecated public DateToken(Date date, TimeZone tz)
java.util.Date object interpreted
relative to the given time zone.
If a null valued token is desired, use NULL.date - the date value of the token, expressed as a
point in time relative to the specified time zonetz - the time zone in which the date should be interpretedpublic boolean equals(Object obj)
DataTokenTokenComparator.equal(TokenValued,TokenValued)
but makes it possible to store DataTokens in Maps.public int hashCode()
DataTokenTokenConverter.asHashCode(TokenValued).public int compareTo(DateToken that)
compareTo in interface Comparable<DateToken>public static DateToken parse(String value)
value - a string value to interpret as a date;
this must be in ISO8601 format.public final ScalarTokenType getType()
TokenValuedgetType in interface ScalarValuedgetType in interface TokenValuedgetType in interface ScalarTypedgetType in interface TokenTypedpublic final long asEpochDays()
DateValuedasEpochDays in interface DateValuedTokenValued.isNull(),
0 is returned.public final Date asDate()
DateValuedjava.sql.Date
relative to the default time zone. The time zone used by
TimeZone.getDefault() is used.asDate in interface DateValuedjava.sql.Date.
If null valued, as indicated by TokenValued.isNull(),
null is returned.public final Date asDate(TimeZone tz)
DateValuedjava.sql.Date
relative to the given time zone.asDate in interface DateValuedtz - 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()
DateValuedasCalendarDate in interface DateValuedTokenValued.isNull(),
null is returned.public final boolean isZero()
ScalarValuedisZero in interface ScalarValuedtrue if the value is the zero value,
false otherwise.public final boolean isNull()
TokenValuedisNull in interface TokenValuedtrue if the token is null valued,
false otherwiseCopyright © 2020 Actian Corporation. All rights reserved.