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, toString, wait, wait, wait
getType, isZero
isNull
public static final TimestampToken NULL
TimestampToken
public static final TimestampToken ZERO
TimestampToken
public 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)
DataToken
TokenComparator.equal(TokenValued,TokenValued)
but makes it possible to store DataToken
s in Map
s.public int hashCode()
DataToken
TokenConverter.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()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public final long asEpochSecs()
TimestampValued
subsecNanos()
in conjunction with this method.asEpochSecs
in interface TimestampValued
TokenValued.isNull()
,
0
is returned.TimestampValued.subsecNanos()
public final int subsecNanos()
TimestampValued
asEpochSecs()
. Thus the value asEpochSecs()
* 1000000000 + subsecNanos()
represents the number of
nanoseconds since Java epoch.subsecNanos
in interface TimestampValued
TokenValued.isNull()
,
0
is returned.TimestampValued.asEpochSecs()
public final int offsetSecs()
TimestampValued
offsetSecs
in interface TimestampValued
TokenValued.isNull()
, 0
is returned.TimestampValued.asEpochSecs()
public final Timestamp asTimestamp()
TimestampValued
java.sql.Timestamp
relative to the default time zone. The time zone used by
TimeZone#getDefault()
is used.asTimestamp
in interface TimestampValued
java.sql.Timestamp
.
If null valued, as indicated by TokenValued.isNull()
,
null
is returned.protected com.pervasive.datarush.tokens.scalar.TimestampParser getParser()
public 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 © 2024 Actian Corporation. All rights reserved.