Class TimestampTokenConverter

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.1
A converter between various formats and 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 Summary

    Constructors
    Constructor
    Description
    Deprecated.
    Constructs a new converter.
    TimestampTokenConverter(long epochSecs, int subsecNanos, int offsetSecs)
    Deprecated.
    Constructs a converter initialized with the specified epoch time.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Deprecated.
    Gets the contained timestamp value as the number of seconds since Java epoch (January 1, 1970 00:00:00 GMT).
    Deprecated.
    Gets a string representation of the current timestamp value.
    Deprecated.
    Gets the contained timestamp value as a java.sql.Timestamp relative to the default time zone.
    Deprecated.
    Gets the data type of the token.
    boolean
    Deprecated.
    Indicates whether the token is null valued.
    boolean
    Deprecated.
    Indicates whether the value is the zero value for the type.
    int
    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
    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
    Deprecated.
    Sets the current value to the specified time-of-day, with the date being today's date.
    int
    Deprecated.
    Gets the subsecond portion of the contained timestamp value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • 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 epoch
      subsecNanos - fractional portion of epoch time in nanoseconds
      offsetSecs - time zone + daylight saving time offset in seconds
  • Method Details

    • 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 interface ScalarTyped
      Specified by:
      getType in interface ScalarValued
      Specified by:
      getType in interface TokenTyped
      Specified by:
      getType in interface TokenValued
      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 interface TokenValued
      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, use subsecNanos() in conjunction with this method.
      Specified by:
      asEpochSecs in interface TimestampValued
      Returns:
      the contained value as days since Java epoch. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      See Also:
    • 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 by asEpochSecs(). Thus the value asEpochSecs() * 1000000000 + subsecNanos() represents the number of nanoseconds since Java epoch.
      Specified by:
      subsecNanos in interface TimestampValued
      Returns:
      the subsecond portion of the contained value, in nanoseconds. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      See Also:
    • 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 interface TimestampValued
      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:
    • 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 interface ScalarValued
      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 epoch
      subsecNanos - fractional portion of epoch time in nanoseconds
      offsetSecs - 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 value
      tz - 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 value
      tz - 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 than TimestampDataUtil.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 than TimestampDataUtil.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 a java.sql.Timestamp relative to the default time zone. The time zone used by TimeZone#getDefault() is used.
      Specified by:
      asTimestamp in interface TimestampValued
      Returns:
      the contained value as a java.sql.Timestamp. If null valued, as indicated by TokenValued.isNull(), null is returned.