java.lang.Object
com.pervasive.datarush.tokens.scalar.DateTokenConverter
- All Implemented Interfaces:
DateValued,ScalarValued,TokenValued,ScalarTyped,TokenTyped
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
ConstructorsConstructorDescriptionDeprecated.Constructs a new converter.DateTokenConverter(long epochDays) Deprecated.Constructs a converter initialized with the specified date. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Gets the contained date value.asDate()Deprecated.Gets the contained date value as ajava.sql.Daterelative to the default time zone.Deprecated.Gets the contained date value as ajava.sql.Daterelative to the given time zone.longDeprecated.Gets the contained date value as the number of days since Java epoch (January 1, 1970).asString()Deprecated.Gets a string representation of the current date value.getType()Deprecated.Gets the data type of the token.booleanisNull()Deprecated.Indicates whether the token is null valued.final booleanisZero()Deprecated.Indicates whether the value is the zero value for the type.voidset(TimestampValued token) Deprecated.Sets the current date value to the date portion of the specified timestamp value.voidDeprecated.Sets the current date value to the date portion of the specified timestamp.voidDeprecated.Sets the current date value to the date portion of the specified Java date in the given time zone.voidsetEpochDays(long epochDays) Deprecated.Sets the current date value to the specified date.
-
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
Deprecated.Description copied from interface:TokenValuedGets the data type of the token. This type will dictate the valid values that can be contained.- Specified by:
getTypein interfaceScalarTyped- Specified by:
getTypein interfaceScalarValued- Specified by:
getTypein interfaceTokenTyped- Specified by:
getTypein interfaceTokenValued- Returns:
- the token type.
-
isNull
public boolean isNull()Deprecated.Description copied from interface:TokenValuedIndicates 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:
isNullin interfaceTokenValued- Returns:
trueif the token is null valued,falseotherwise
-
asEpochDays
public long asEpochDays()Deprecated.Description copied from interface:DateValuedGets the contained date value as the number of days since Java epoch (January 1, 1970).- Specified by:
asEpochDaysin interfaceDateValued- Returns:
- the contained value as days since Java epoch.
If null valued, as indicated by
TokenValued.isNull(),0is returned.
-
isZero
public final boolean isZero()Deprecated.Description copied from interface:ScalarValuedIndicates whether the value is the zero value for the type. Zero values are not stored in sparse representation formats.- Specified by:
isZeroin interfaceScalarValued- Returns:
trueif the value is the zero value,falseotherwise.
-
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
Deprecated.Description copied from interface:DateValuedGets the contained date value as ajava.sql.Daterelative to the default time zone. The time zone id used by {@link ZoneId.systemDefault()} is used.- Specified by:
asDatein interfaceDateValued- Returns:
- the contained value as a
java.sql.Date. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
asDate
Deprecated.Description copied from interface:DateValuedGets the contained date value as ajava.sql.Daterelative to the given time zone.- Specified by:
asDatein interfaceDateValued- 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 byTokenValued.isNull(),nullis returned.
-
asCalendarDate
Deprecated.Description copied from interface:DateValuedGets the contained date value. This value represents the timezone free date portion of a timestamp.- Specified by:
asCalendarDatein interfaceDateValued- Returns:
- the contained value as a calendar date.
If null valued, as indicated by
TokenValued.isNull(),nullis returned.
-
set
Deprecated.Sets the current date value to the date portion of the specified timestamp value.- Parameters:
token- the timestamp value to truncate
-
set
Deprecated.Sets the current date value to the date portion of the specified Java date in the given time zone.- Parameters:
date- the timestamp valuetz- the time zone to which the timestamp is relative
-
asString
Deprecated.Gets a string representation of the current date value.- Returns:
- an ISO 8601 date string
-
set
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
DateTokenConverteris more efficient thanDateDataUtil.parse(String).- Parameters:
timestamp- an ISO 8601 timestamp value
-