- 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 CalendarDate
asCalendarDate()
Deprecated.Gets the contained date value.Date
asDate()
Deprecated.Gets the contained date value as ajava.sql.Date
relative to the default time zone.Date
asDate(TimeZone tz)
Deprecated.Gets the contained date value as ajava.sql.Date
relative to the given time zone.long
asEpochDays()
Deprecated.Gets the contained date value as the number of days since Java epoch (January 1, 1970).String
asString()
Deprecated.Gets a string representation of the current date value.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.void
set(TimestampValued token)
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, TimeZone tz)
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.
-
-
-
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: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
-
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 interfaceDateValued
- 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 interfaceScalarValued
- 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 ajava.sql.Date
relative to the default time zone. The time zone used byTimeZone.getDefault()
is used.- Specified by:
asDate
in interfaceDateValued
- Returns:
- the contained value as a
java.sql.Date
. If null valued, as indicated byTokenValued.isNull()
,null
is returned.
-
asDate
public Date asDate(TimeZone tz)
Deprecated.Description copied from interface:DateValued
Gets the contained date value as ajava.sql.Date
relative to the given time zone.- Specified by:
asDate
in 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()
,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 interfaceDateValued
- 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, 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
DateTokenConverter
is more efficient thanDateDataUtil.parse(String)
.- Parameters:
timestamp
- an ISO 8601 timestamp value
-
-