@Deprecated public class TimestampTokenConverter extends Object implements TimestampValued
TimestampToken
.
Utilities for some of the same conversions are also available
in TimestampDataUtil
. However, if many conversions
are to be performed, it is more efficient to reuse
a TimestampTokenConverter
.
Constructor and Description |
---|
TimestampTokenConverter()
Deprecated.
Constructs a new converter.
|
TimestampTokenConverter(long epochSecs,
int subsecNanos,
int offsetSecs)
Deprecated.
Constructs a converter initialized with the specified
epoch time.
|
Modifier and Type | Method and Description |
---|---|
long |
asEpochSecs()
Deprecated.
Gets the contained timestamp value as the number of seconds since
Java epoch (January 1, 1970 00:00:00 GMT).
|
String |
asString()
Deprecated.
Gets a string representation of the current timestamp value.
|
Timestamp |
asTimestamp()
Deprecated.
Gets the contained timestamp value as a
java.sql.Timestamp
relative to the default time zone. |
ScalarTokenType |
getType()
Deprecated.
Gets the data type of the token.
|
boolean |
isNull()
Deprecated.
Indicates whether the token is null valued.
|
boolean |
isZero()
Deprecated.
Indicates whether the value is the zero value
for the type.
|
int |
offsetSecs()
Deprecated.
Gets the time zone and daylight saving time offset of the contained
timestamp value, in seconds.
|
void |
set(Date d,
TimeZone tz)
Deprecated.
Sets the current value to the specified timestamp in
the given time zone.
|
void |
set(String value)
Deprecated.
Sets the current value to the specified timestamp.
|
void |
set(Timestamp ts,
TimeZone tz)
Deprecated.
Sets the current value to the specified timestamp in
the given time zone.
|
void |
setEpochTime(long epochSecs,
int subsecNanos,
int offsetSecs)
Deprecated.
Sets the current value to the specified epoch time.
|
void |
setTime(String time)
Deprecated.
Sets the current value to the specified time-of-day,
with the date being today's date.
|
int |
subsecNanos()
Deprecated.
Gets the subsecond portion of the contained timestamp value.
|
public TimestampTokenConverter()
public TimestampTokenConverter(long epochSecs, int subsecNanos, int offsetSecs)
epochSecs
- number of seconds since Java epochsubsecNanos
- fractional portion of epoch time in nanosecondsoffsetSecs
- time zone + daylight saving time offset in secondspublic ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public boolean isNull()
TokenValued
isNull
in interface TokenValued
true
if the token is null valued,
false
otherwisepublic long asEpochSecs()
TimestampValued
subsecNanos()
in conjunction with this method.asEpochSecs
in interface TimestampValued
TokenValued.isNull()
,
0
is returned.TimestampValued.subsecNanos()
public 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 int offsetSecs()
TimestampValued
offsetSecs
in interface TimestampValued
TokenValued.isNull()
, 0
is returned.TimestampValued.asEpochSecs()
public boolean isZero()
ScalarValued
isZero
in interface ScalarValued
true
if the value is the zero value,
false
otherwise.public String asString()
public void setEpochTime(long epochSecs, int subsecNanos, int offsetSecs)
epochSecs
- number of seconds since Java epochsubsecNanos
- fractional portion of epoch time in nanosecondsoffsetSecs
- time zone + daylight saving time offset in secondspublic void set(Date d, TimeZone tz)
d
- the timestamp valuetz
- the time zone in which the timestamp appliespublic void set(Timestamp ts, TimeZone tz)
ts
- the timestamp valuetz
- the time zone in which the timestamp appliespublic void set(String value)
For repeated parsing of strings, reuse of a
TimestapTokenConverter
is more efficient
than TimestampDataUtil.parse(String)
.
value
- an ISO 8601 timestamp valuepublic void setTime(String time)
For repeated parsing of strings, reuse of a
TimestapTokenConverter
is more efficient
than TimestampDataUtil.parse(String)
.
time
- an ISO 8601 time valuepublic 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.Copyright © 2019 Actian Corporation. All rights reserved.