java.lang.Object
com.pervasive.datarush.tokens.scalar.TimestampRegister
- All Implemented Interfaces:
DataRegister,ScalarRegister,ScalarSettable,ScalarValued,TimestampSettable,TimestampValued,TokenSettable,TokenValued,ScalarTyped,TokenTyped,Serializable
A mutable
TimestampValued object.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal longGets the contained timestamp value as the number of seconds since Java epoch (January 1, 1970 00:00:00 GMT).final TimestampGets the contained timestamp value as ajava.sql.Timestamprelative to the default time zone.protected com.pervasive.datarush.tokens.scalar.TimestampParserGet the cached parser used by this object.final ScalarTokenTypegetType()Gets the data type of the token.final booleanisNull()Indicates whether the token is null valued.booleanisZero()Indicates whether the value is the zero value for the type.final intGets 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.voidSets the container to a timestamp value specified as ajava.sql.Timestampobject, relative to the default time zone.voidSets the container to a timestamp value specified as ajava.sql.Timestampobject, relative to the given time zone.voidSets the container to a timestamp value specified as ajava.util.Dateobject, relative to the default time zone.voidSets 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.final intGets the subsecond portion of the contained timestamp value.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.pervasive.datarush.types.ScalarTyped
getTypeMethods inherited from interface com.pervasive.datarush.tokens.scalar.ScalarValued
getType, isZeroMethods inherited from interface com.pervasive.datarush.tokens.TokenValued
isNull
-
Constructor Details
-
TimestampRegister
public TimestampRegister()Creates a new null-valued register.
-
-
Method Details
-
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
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 by {@link ZoneId.systemDefault()} 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
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.zoneId- the time zone id in which the timestamp should be interpreted
-
set
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 id returned by {@link ZoneId.systemDefault()} 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
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.zoneId- the time zone id 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
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
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:
-
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:
-
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:
-
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
-
toString
-
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
-