public final class TimestampToken extends Object implements ScalarToken, Comparable<TimestampToken>
TimestampValued object.| Modifier and Type | Field and Description |
|---|---|
static TimestampToken |
NULL
A null valued
TimestampToken |
static TimestampToken |
ZERO
A zero valued
TimestampToken |
| Constructor and Description |
|---|
TimestampToken(long epochSecs,
int subsecNanos,
int offsetSecs)
Constructs a new token with the non-null timestamp value
specified as the number of seconds since Java epoch
(January 1, 1970 00:00:00 GMT).
|
TimestampToken(TimestampValued value)
Constructs a new token with the timestamp
value in the given container.
|
| Modifier and Type | Method and Description |
|---|---|
long |
asEpochSecs()
Gets the contained timestamp value as the number of seconds since
Java epoch (January 1, 1970 00:00:00 GMT).
|
Timestamp |
asTimestamp()
Gets the contained timestamp value as a
java.sql.Timestamp
relative to the default time zone. |
int |
compareTo(TimestampToken that) |
boolean |
equals(Object obj)
Indicates whether another object is equal to this token.
|
protected com.pervasive.datarush.tokens.scalar.TimestampParser |
getParser()
Get the cached parser used by this object.
|
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.
|
int |
offsetSecs()
Gets the time zone and daylight saving time offset of the contained
timestamp value, in seconds.
|
static TimestampToken |
parse(String value)
Converts a string representation of a timestamp value into
a token.
|
int |
subsecNanos()
Gets the subsecond portion of the contained timestamp value.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetType, isZeroisNullpublic static final TimestampToken NULL
TimestampTokenpublic static final TimestampToken ZERO
TimestampTokenpublic TimestampToken(TimestampValued value)
value - a TimestampValued containing the
desired valuepublic TimestampToken(long epochSecs,
int subsecNanos,
int offsetSecs)
NULL.epochSecs - number of seconds since Java epochsubsecNanos - fractional portion of epoch time in nanosecondsoffsetSecs - time zone and daylight saving time offset in secondspublic 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(TimestampToken that)
compareTo in interface Comparable<TimestampToken>public static TimestampToken parse(String value)
value - a string value to interpret as a timestamp;
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 asEpochSecs()
TimestampValuedsubsecNanos()
in conjunction with this method.asEpochSecs in interface TimestampValuedTokenValued.isNull(),
0 is returned.TimestampValued.subsecNanos()public final int subsecNanos()
TimestampValuedasEpochSecs(). Thus the value asEpochSecs()
* 1000000000 + subsecNanos() represents the number of
nanoseconds since Java epoch.subsecNanos in interface TimestampValuedTokenValued.isNull(),
0 is returned.TimestampValued.asEpochSecs()public final int offsetSecs()
TimestampValuedoffsetSecs in interface TimestampValuedTokenValued.isNull(), 0 is returned.TimestampValued.asEpochSecs()public final Timestamp asTimestamp()
TimestampValuedjava.sql.Timestamp
relative to the default time zone. The time zone used by
TimeZone#getDefault() is used.asTimestamp in interface TimestampValuedjava.sql.Timestamp.
If null valued, as indicated by TokenValued.isNull(),
null is returned.protected com.pervasive.datarush.tokens.scalar.TimestampParser getParser()
public 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 © 2016 Actian Corporation. All rights reserved.