- 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.1A converter between various formats andDateToken.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 aDateTokenConverter.
-
-
Constructor Summary
Constructors Constructor Description DateTokenConverter()Deprecated.Constructs a new converter.DateTokenConverter(long epochDays)Deprecated.Constructs a converter initialized with the specified date.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CalendarDateasCalendarDate()Deprecated.Gets the contained date value.DateasDate()Deprecated.Gets the contained date value as ajava.sql.Daterelative to the default time zone.DateasDate(TimeZone tz)Deprecated.Gets the contained date value as ajava.sql.Daterelative to the given time zone.longasEpochDays()Deprecated.Gets the contained date value as the number of days since Java epoch (January 1, 1970).StringasString()Deprecated.Gets a string representation of the current date value.ScalarTokenTypegetType()Deprecated.Gets the data type of the token.booleanisNull()Deprecated.Indicates whether the token is null valued.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.voidset(String timestamp)Deprecated.Sets the current date value to the date portion of the specified timestamp.voidset(Date date, TimeZone tz)Deprecated.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 Detail
-
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 Detail
-
getType
public ScalarTokenType 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
public Date asDate()
Deprecated.Description copied from interface:DateValuedGets the contained date value as ajava.sql.Daterelative to the default time zone. The time zone used byTimeZone.getDefault()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
public Date asDate(TimeZone tz)
Deprecated.Description copied from interface:DateValuedGets the contained date value as ajava.sql.Daterelative to the given time zone.- Specified by:
asDatein interfaceDateValued- Parameters:
tz- the time zone 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
public CalendarDate 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
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, TimeZone tz)
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
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
DateTokenConverteris more efficient thanDateDataUtil.parse(String).- Parameters:
timestamp- an ISO 8601 timestamp value
-
-