- java.lang.Object
-
- com.pervasive.datarush.tokens.scalar.TimestampRegister
-
- All Implemented Interfaces:
DataRegister,ScalarRegister,ScalarSettable,ScalarValued,TimestampSettable,TimestampValued,TokenSettable,TokenValued,ScalarTyped,TokenTyped,Serializable
public final class TimestampRegister extends Object implements ScalarRegister, TimestampSettable
A mutableTimestampValuedobject.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TimestampRegister()Creates a new null-valued register.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longasEpochSecs()Gets the contained timestamp value as the number of seconds since Java epoch (January 1, 1970 00:00:00 GMT).TimestampasTimestamp()Gets the contained timestamp value as ajava.sql.Timestamprelative to the default time zone.protected com.pervasive.datarush.tokens.scalar.TimestampParsergetParser()Get the cached parser used by this object.ScalarTokenTypegetType()Gets the data type of the token.booleanisNull()Indicates whether the token is null valued.booleanisZero()Indicates whether the value is the zero value for the type.intoffsetSecs()Gets the time zone and daylight saving time offset of the contained timestamp value, in seconds.voidset(long seconds, int nanos, int offsetSeconds)Sets the container to a timestamp value specified as time since Java epoch (January 1, 1970 00:00:00 GMT) with time zone and daylight saving time offset.voidset(TokenValued value)Sets the contained value to the given token value.voidset(Timestamp timestamp)Sets the container to a timestamp value specified as ajava.sql.Timestampobject, relative to the default time zone.voidset(Timestamp timestamp, TimeZone timeZone)Sets the container to a timestamp value specified as ajava.sql.Timestampobject, relative to the given time zone.voidset(Date date)Sets the container to a timestamp value specified as ajava.util.Dateobject, relative to the default time zone.voidset(Date date, TimeZone timeZone)Sets the container to a timestamp value specified as ajava.util.Dateobject, relative to the given time zone.voidsetNull()Sets the contained value to be null valued.voidsetZero()Sets the contained value to be zero valued.intsubsecNanos()Gets the subsecond portion of the contained timestamp value.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.pervasive.datarush.types.ScalarTyped
getType
-
Methods inherited from interface com.pervasive.datarush.tokens.scalar.ScalarValued
getType, isZero
-
Methods inherited from interface com.pervasive.datarush.tokens.TokenValued
isNull
-
-
-
-
Method Detail
-
setNull
public void setNull()
Description copied from interface:TokenSettableSets the contained value to be null valued.- Specified by:
setNullin interfaceTokenSettable
-
setZero
public void setZero()
Description copied from interface:TokenSettableSets the contained value to be zero valued.- Specified by:
setZeroin interfaceTokenSettable
-
set
public void set(Date date)
Description copied from interface:TimestampSettableSets the container to a timestamp value specified as ajava.util.Dateobject, relative to the default time zone. The time zone returned byTimeZone.getDefault()is used.- Specified by:
setin interfaceTimestampSettable- Parameters:
date- timestamp value to which to set the container, expressed as a point in time relative to the default time zone.
-
set
public void set(Date date, TimeZone timeZone)
Description copied from interface:TimestampSettableSets the container to a timestamp value specified as ajava.util.Dateobject, relative to the given time zone.- Specified by:
setin interfaceTimestampSettable- Parameters:
date- timestamp value to which to set the container, expressed as a point in time relative to the default time zone.timeZone- the time zone in which the timestamp should be interpreted
-
set
public void set(Timestamp timestamp)
Description copied from interface:TimestampSettableSets the container to a timestamp value specified as ajava.sql.Timestampobject, relative to the default time zone. The time zone returned byTimeZone.getDefault()is used.- Specified by:
setin interfaceTimestampSettable- Parameters:
timestamp- timestamp value to which to set the container, expressed as a point in time relative to the default time zone.
-
set
public void set(Timestamp timestamp, TimeZone timeZone)
Description copied from interface:TimestampSettableSets the container to a timestamp value specified as ajava.sql.Timestampobject, relative to the given time zone.- Specified by:
setin interfaceTimestampSettable- Parameters:
timestamp- timestamp value to which to set the container, expressed as a point in time relative to the default time zone.timeZone- the time zone in which the timestamp should be interpreted
-
set
public void set(long seconds, int nanos, int offsetSeconds)Description copied from interface:TimestampSettableSets the container to a timestamp value specified as time since Java epoch (January 1, 1970 00:00:00 GMT) with time zone and daylight saving time offset.- Specified by:
setin interfaceTimestampSettable- Parameters:
seconds- number of seconds since Java epochnanos- fractional portion of epoch time in nanosecondsoffsetSeconds- time zone and daylight saving time offset, in seconds
-
set
public void set(TokenValued value)
Description copied from interface:TokenSettableSets the contained value to the given token value. The given value must have a type compatible with this object.- Specified by:
setin interfaceTokenSettable- Parameters:
value- the value to which to set the container
-
getType
public final ScalarTokenType getType()
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.
-
asEpochSecs
public final long asEpochSecs()
Description copied from interface:TimestampValuedGets 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, usesubsecNanos()in conjunction with this method.- Specified by:
asEpochSecsin interfaceTimestampValued- Returns:
- the contained value as days since Java epoch.
If null valued, as indicated by
TokenValued.isNull(),0is returned. - See Also:
TimestampValued.subsecNanos()
-
subsecNanos
public final int subsecNanos()
Description copied from interface:TimestampValuedGets the subsecond portion of the contained timestamp value. The value returned is relative to the seconds value returned byasEpochSecs(). Thus the valueasEpochSecs() * 1000000000 + subsecNanos()represents the number of nanoseconds since Java epoch.- Specified by:
subsecNanosin interfaceTimestampValued- Returns:
- the subsecond portion of the contained value, in
nanoseconds. If null valued, as indicated by
TokenValued.isNull(),0is returned. - See Also:
TimestampValued.asEpochSecs()
-
offsetSecs
public final int offsetSecs()
Description copied from interface:TimestampValuedGets the time zone and daylight saving time offset of the contained timestamp value, in seconds.- Specified by:
offsetSecsin interfaceTimestampValued- Returns:
- the time zone and daylight saving time offset of the
contained value, in seconds. If null valued, as indicated by
TokenValued.isNull(),0is returned. - See Also:
TimestampValued.asEpochSecs()
-
asTimestamp
public final Timestamp asTimestamp()
Description copied from interface:TimestampValuedGets the contained timestamp value as ajava.sql.Timestamprelative to the default time zone. The time zone used byTimeZone#getDefault()is used.- Specified by:
asTimestampin interfaceTimestampValued- Returns:
- the contained value as a
java.sql.Timestamp. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
getParser
protected com.pervasive.datarush.tokens.scalar.TimestampParser getParser()
Get the cached parser used by this object.- Returns:
- the cached parser
-
isZero
public boolean isZero()
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.
-
isNull
public final boolean isNull()
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
-
-