Class DateTokenConverter

java.lang.Object
com.pervasive.datarush.tokens.scalar.DateTokenConverter
All Implemented Interfaces:
DateValued, ScalarValued, TokenValued, ScalarTyped, TokenTyped

@Deprecated public class DateTokenConverter extends Object implements DateValued
Deprecated.
since 6.1
A converter between various formats and DateToken.

Utilities for many of the same conversions are also available in DateDataUtil. However, if many conversions are to be performed, it is more efficient to reuse a DateTokenConverter.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
    Constructs a new converter.
    DateTokenConverter(long epochDays)
    Deprecated.
    Constructs a converter initialized with the specified date.
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    Gets the contained date value.
    Deprecated.
    Gets the contained date value as a java.sql.Date relative to the default time zone.
    asDate(ZoneId zoneId)
    Deprecated.
    Gets the contained date value as a java.sql.Date relative to the given time zone.
    long
    Deprecated.
    Gets the contained date value as the number of days since Java epoch (January 1, 1970).
    Deprecated.
    Gets a string representation of the current date value.
    Deprecated.
    Gets the data type of the token.
    boolean
    Deprecated.
    Indicates whether the token is null valued.
    final boolean
    Deprecated.
    Indicates whether the value is the zero value for the type.
    void
    Deprecated.
    Sets the current date value to the date portion of the specified timestamp value.
    void
    set(String timestamp)
    Deprecated.
    Sets the current date value to the date portion of the specified timestamp.
    void
    set(Date date, ZoneId zoneId)
    Deprecated.
    Sets the current date value to the date portion of the specified Java date in the given time zone.
    void
    setEpochDays(long epochDays)
    Deprecated.
    Sets the current date value to the specified date.

    Methods inherited from class java.lang.Object

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

    • DateTokenConverter

      public DateTokenConverter()
      Deprecated.
      Constructs a new converter. The date value is initialized to the start of epoch.
    • DateTokenConverter

      public DateTokenConverter(long epochDays)
      Deprecated.
      Constructs a converter initialized with the specified date.
      Parameters:
      epochDays - the date specified in epoch days.
  • 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
    • asEpochDays

      public long asEpochDays()
      Deprecated.
      Description copied from interface: DateValued
      Gets the contained date value as the number of days since Java epoch (January 1, 1970).
      Specified by:
      asEpochDays in interface DateValued
      Returns:
      the contained value as days since Java epoch. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • isZero

      public final 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.
    • setEpochDays

      public void setEpochDays(long epochDays)
      Deprecated.
      Sets the current date value to the specified date.
      Parameters:
      epochDays - the date specified in epoch days.
    • asDate

      public Date asDate()
      Deprecated.
      Description copied from interface: DateValued
      Gets the contained date value as a java.sql.Date relative to the default time zone. The time zone id used by {@link ZoneId.systemDefault()} is used.
      Specified by:
      asDate in interface DateValued
      Returns:
      the contained value as a java.sql.Date. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asDate

      public Date asDate(ZoneId zoneId)
      Deprecated.
      Description copied from interface: DateValued
      Gets the contained date value as a java.sql.Date relative to the given time zone.
      Specified by:
      asDate in interface DateValued
      Parameters:
      zoneId - the time zone id in which to interpret the date
      Returns:
      the contained value as a java.sql.Date. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asCalendarDate

      public CalendarDate asCalendarDate()
      Deprecated.
      Description copied from interface: DateValued
      Gets the contained date value. This value represents the timezone free date portion of a timestamp.
      Specified by:
      asCalendarDate in interface DateValued
      Returns:
      the contained value as a calendar date. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • set

      public void set(TimestampValued token)
      Deprecated.
      Sets the current date value to the date portion of the specified timestamp value.
      Parameters:
      token - the timestamp value to truncate
    • set

      public void set(Date date, ZoneId zoneId)
      Deprecated.
      Sets the current date value to the date portion of the specified Java date in the given time zone.
      Parameters:
      date - the timestamp value
      tz - the time zone to which the timestamp is relative
    • asString

      public String asString()
      Deprecated.
      Gets a string representation of the current date value.
      Returns:
      an ISO 8601 date string
    • set

      public void set(String timestamp)
      Deprecated.
      Sets the current date value to the date portion of the specified timestamp. The timestamp must be a string in ISO 8601 format.

      For repeated parsing of strings, reuse of a DateTokenConverter is more efficient than DateDataUtil.parse(String).

      Parameters:
      timestamp - an ISO 8601 timestamp value