- java.lang.Object
-
- com.pervasive.datarush.tokens.scalar.TimestampTokenConverter
-
- All Implemented Interfaces:
ScalarValued
,TimestampValued
,TokenValued
,ScalarTyped
,TokenTyped
@Deprecated public class TimestampTokenConverter extends Object implements TimestampValued
Deprecated.since 6.1A converter between various formats andTimestampToken
.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 aTimestampTokenConverter
.
-
-
Constructor Summary
Constructors Constructor Description TimestampTokenConverter()
Deprecated.Constructs a new converter.TimestampTokenConverter(long epochSecs, int subsecNanos, int offsetSecs)
Deprecated.Constructs a converter initialized with the specified epoch time.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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 ajava.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(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
set(Date d, 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.
-
-
-
Constructor Detail
-
TimestampTokenConverter
public TimestampTokenConverter()
Deprecated.Constructs a new converter. The timestamp value is initialized to the start of epoch.
-
TimestampTokenConverter
public TimestampTokenConverter(long epochSecs, int subsecNanos, int offsetSecs)
Deprecated.Constructs a converter initialized with the specified epoch time. Epoch time is expressed as time elapsed since January 1, 1970 00:00:00 GMT.- Parameters:
epochSecs
- number of seconds since Java epochsubsecNanos
- fractional portion of epoch time in nanosecondsoffsetSecs
- time zone + daylight saving time offset in seconds
-
-
Method Detail
-
getType
public ScalarTokenType getType()
Deprecated.Description copied from interface:TokenValued
Gets the data type of the token. This type will dictate the valid values that can be contained.- Specified by:
getType
in interfaceScalarTyped
- Specified by:
getType
in interfaceScalarValued
- Specified by:
getType
in interfaceTokenTyped
- Specified by:
getType
in interfaceTokenValued
- Returns:
- the token type.
-
isNull
public boolean isNull()
Deprecated.Description copied from interface:TokenValued
Indicates whether the token is null valued. Tokens support null values analogous to SQL. Before accessing the value of the container, it is usually best to ensure it is not null valued using this method.- Specified by:
isNull
in interfaceTokenValued
- Returns:
true
if the token is null valued,false
otherwise
-
asEpochSecs
public long asEpochSecs()
Deprecated.Description copied from interface:TimestampValued
Gets the contained timestamp value as the number of seconds since Java epoch (January 1, 1970 00:00:00 GMT). Timestamp values support nanosecond precision, although this method does not expose it. To access this level of detail, usesubsecNanos()
in conjunction with this method.- Specified by:
asEpochSecs
in interfaceTimestampValued
- Returns:
- the contained value as days since Java epoch.
If null valued, as indicated by
TokenValued.isNull()
,0
is returned. - See Also:
TimestampValued.subsecNanos()
-
subsecNanos
public int subsecNanos()
Deprecated.Description copied from interface:TimestampValued
Gets the subsecond portion of the contained timestamp value. The value returned is relative to the seconds value returned byasEpochSecs()
. Thus the valueasEpochSecs() * 1000000000 + subsecNanos()
represents the number of nanoseconds since Java epoch.- Specified by:
subsecNanos
in interfaceTimestampValued
- Returns:
- the subsecond portion of the contained value, in
nanoseconds. If null valued, as indicated by
TokenValued.isNull()
,0
is returned. - See Also:
TimestampValued.asEpochSecs()
-
offsetSecs
public int offsetSecs()
Deprecated.Description copied from interface:TimestampValued
Gets the time zone and daylight saving time offset of the contained timestamp value, in seconds.- Specified by:
offsetSecs
in interfaceTimestampValued
- Returns:
- the time zone and daylight saving time offset of the
contained value, in seconds. If null valued, as indicated by
TokenValued.isNull()
,0
is returned. - See Also:
TimestampValued.asEpochSecs()
-
isZero
public boolean isZero()
Deprecated.Description copied from interface:ScalarValued
Indicates whether the value is the zero value for the type. Zero values are not stored in sparse representation formats.- Specified by:
isZero
in interfaceScalarValued
- Returns:
true
if the value is the zero value,false
otherwise.
-
asString
public String asString()
Deprecated.Gets a string representation of the current timestamp value.- Returns:
- an ISO 8601 timestamp string
-
setEpochTime
public void setEpochTime(long epochSecs, int subsecNanos, int offsetSecs)
Deprecated.Sets the current value to the specified epoch time. Epoch time is expressed as time elapsed since January 1, 1970 00:00:00 GMT.- Parameters:
epochSecs
- number of seconds since Java epochsubsecNanos
- fractional portion of epoch time in nanosecondsoffsetSecs
- time zone + daylight saving time offset in seconds
-
set
public void set(Date d, TimeZone tz)
Deprecated.Sets the current value to the specified timestamp in the given time zone.- Parameters:
d
- the timestamp valuetz
- the time zone in which the timestamp applies
-
set
public void set(Timestamp ts, TimeZone tz)
Deprecated.Sets the current value to the specified timestamp in the given time zone.- Parameters:
ts
- the timestamp valuetz
- the time zone in which the timestamp applies
-
set
public void set(String value)
Deprecated.Sets the current value to the specified timestamp. The timestamp must be a string in ISO 8601 format.For repeated parsing of strings, reuse of a
TimestapTokenConverter
is more efficient thanTimestampDataUtil.parse(String)
.- Parameters:
value
- an ISO 8601 timestamp value
-
setTime
public void setTime(String time)
Deprecated.Sets the current value to the specified time-of-day, with the date being today's date. The time must be a string in ISO 8601 format.For repeated parsing of strings, reuse of a
TimestapTokenConverter
is more efficient thanTimestampDataUtil.parse(String)
.- Parameters:
time
- an ISO 8601 time value
-
asTimestamp
public Timestamp asTimestamp()
Deprecated.Description copied from interface:TimestampValued
Gets the contained timestamp value as ajava.sql.Timestamp
relative to the default time zone. The time zone used byTimeZone#getDefault()
is used.- Specified by:
asTimestamp
in interfaceTimestampValued
- Returns:
- the contained value as a
java.sql.Timestamp
. If null valued, as indicated byTokenValued.isNull()
,null
is returned.
-
-