- java.lang.Object
-
- com.pervasive.datarush.tokens.scalar.NullToken
-
- All Implemented Interfaces:
DataToken,BinaryValued,BooleanValued,CharValued,DateValued,DoubleValued,DurationValued,FloatValued,IntValued,Ip4AddressValued,Ip6AddressValued,LongValued,MoneyValued,NumericValued,PeriodValued,ScalarToken,ScalarValued,StringValued,TimestampValued,TimeValued,TokenValued,ScalarTyped,TokenTyped,Serializable,Comparable<NullToken>
public class NullToken extends Object implements ScalarToken, Comparable<NullToken>, BinaryValued, BooleanValued, CharValued, DateValued, IntValued, StringValued, TimeValued, TimestampValued, MoneyValued, DurationValued, PeriodValued, Ip4AddressValued, Ip6AddressValued
An null token.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static NullTokenNULLA null valuedNullToken-
Fields inherited from interface com.pervasive.datarush.tokens.scalar.NumericValued
MAX_INFINITY, MIN_INFINITY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNullToken()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]asAddress()Gets the contained raw IPv4 address value.BigDecimalasBigDecimal()Gets the contained numeric value.byte[]asBinary()Gets the contained binary value.byte[]asBinaryRef()Gets a reference to the contained binary value.booleanasBoolean()Gets the contained boolean value.CalendarDateasCalendarDate()Gets the contained date value.longasCents()Gets the contained cents value as a longcharasChar()Gets the contained character value.DateasDate()Gets the contained date value as ajava.sql.Daterelative to the default time zone.DateasDate(TimeZone tz)Gets the contained date value as ajava.sql.Daterelative to the given time zone.intasDayMillis()Gets the contained time value as the number of milliseconds elapsed since midnight.doubleasDouble()Gets the contained double value.DurationasDuration()Gets the contained Duration value as ajava.time.Duration.longasEpochDays()Gets the contained date value as the number of days since Java epoch (January 1, 1970).longasEpochSecs()Gets the contained timestamp value as the number of seconds since Java epoch (January 1, 1970 00:00:00 GMT).floatasFloat()Gets the contained float value.Inet4AddressasInet4Address()Gets the contained IP address as an Inet4Address.Inet6AddressasInet6Address()Gets the contained IP address as an Inet6Address.intasInt()Gets the contained integer value.longasLong()Gets the contained long value.PeriodasPeriod()Gets the contained Period value as ajava.time.Period.longasSeconds()Get the contained duration value as the number of seconds.StringasString()Gets the contained string value.TimeOfDayasTimeOfDay()Gets the contained time value.TimestampasTimestamp()Gets the contained timestamp value as ajava.sql.Timestamprelative to the default time zone.intcompareTo(NullToken o)booleanequals(Object obj)Indicates whether another object is equal to this token.intgetDays()Gets the day portion of the contained period value.intgetMonths()Gets the month portion of the contained period value.ScalarTokenTypegetType()Gets the data type of the token.intgetYears()Gets the year portion of the contained period value.inthashCode()Returns a hash code for 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.intsubsecNanos()Gets the subsecond portion of the contained timestamp value.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.pervasive.datarush.tokens.TokenValued
isNull
-
-
-
-
Field Detail
-
NULL
public static final NullToken NULL
A null valuedNullToken
-
-
Method Detail
-
compareTo
public int compareTo(NullToken o)
- Specified by:
compareToin interfaceComparable<NullToken>
-
equals
public boolean equals(Object obj)
Description copied from interface:DataTokenIndicates whether another object is equal to this token. Two null valued tokens are considered equal. This differs from the behavior ofTokenComparator.equal(TokenValued,TokenValued)but makes it possible to storeDataTokens inMaps.
-
hashCode
public int hashCode()
Description copied from interface:DataTokenReturns a hash code for the token. This value is guaranteed to be consistent with that returned byTokenConverter.asHashCode(TokenValued).
-
getType
public 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.
-
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.
-
asDouble
public double asDouble()
Description copied from interface:DoubleValuedGets the contained double value.- Specified by:
asDoublein interfaceDoubleValued- Returns:
- the contained value as a
double. If null valued, as indicated byTokenValued.isNull(),Double.NaNis returned.
-
asBigDecimal
public BigDecimal asBigDecimal()
Description copied from interface:NumericValuedGets the contained numeric value.- Specified by:
asBigDecimalin interfaceNumericValued- Returns:
- the contained value as a
java.math.BigDecimal. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
asLong
public long asLong()
Description copied from interface:LongValuedGets the contained long value.- Specified by:
asLongin interfaceLongValued- Returns:
- the contained value as a
long. If null valued, as indicated byTokenValued.isNull(),0is returned.
-
asFloat
public float asFloat()
Description copied from interface:FloatValuedGets the contained float value.- Specified by:
asFloatin interfaceFloatValued- Returns:
- the contained value as a
float. If null valued, as indicated byTokenValued.isNull(),Float.NaNis returned.
-
asTimestamp
public 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.
-
asEpochSecs
public 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 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 interfaceDurationValued- 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 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()
-
asDayMillis
public int asDayMillis()
Description copied from interface:TimeValuedGets the contained time value as the number of milliseconds elapsed since midnight.- Specified by:
asDayMillisin interfaceTimeValued- Returns:
- the contained value as milliseconds since midnight.
If null valued, as indicated by
TokenValued.isNull(),0is returned.
-
asTimeOfDay
public TimeOfDay asTimeOfDay()
Description copied from interface:TimeValuedGets the contained time value. This value represents the timezone free time portion of a timestamp.- Specified by:
asTimeOfDayin interfaceTimeValued- Returns:
- the contained value.
If null valued, as indicated by
TokenValued.isNull(),nullis returned.
-
asString
public String asString()
Description copied from interface:StringValuedGets the contained string value.- Specified by:
asStringin interfaceStringValued- Returns:
- the contained value as a
String. If null valued, as indicated byTokenValued.isNull(), the empty string ("") is returned.
-
asInt
public int asInt()
Description copied from interface:IntValuedGets the contained integer value.- Specified by:
asIntin interfaceIntValued- Returns:
- the contained value as an
int. If null valued, as indicated byTokenValued.isNull(),0is returned.
-
asDate
public Date asDate()
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)
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.
-
asEpochDays
public long asEpochDays()
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.
-
asCalendarDate
public CalendarDate asCalendarDate()
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.
-
asChar
public char asChar()
Description copied from interface:CharValuedGets the contained character value.- Specified by:
asCharin interfaceCharValued- Returns:
- the contained value as a
char. If null valued, as indicated byTokenValued.isNull(),Character.MAX_VALUEis returned.
-
asBoolean
public boolean asBoolean()
Description copied from interface:BooleanValuedGets the contained boolean value.- Specified by:
asBooleanin interfaceBooleanValued- Returns:
- the contained value as a
boolean. If null valued, as indicated byTokenValued.isNull(),falseis returned.
-
asBinary
public byte[] asBinary()
Description copied from interface:BinaryValuedGets the contained binary value.The array returned is a copy of the binary data contained in the object. To avoid this overhead, use
BinaryValued.asBinaryRef()instead.- Specified by:
asBinaryin interfaceBinaryValued- Returns:
- the contained value as a
byte[]. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
asBinaryRef
public byte[] asBinaryRef()
Description copied from interface:BinaryValuedGets a reference to the contained binary value.While this call avoids the overhead seen with
BinaryValued.asBinary(), the caller must guarantee that the returned array will not be modified. Failure to comply may result in the dataflow exhibiting unexpected behavior, as other operators may (or may not) see the modified value.- Specified by:
asBinaryRefin interfaceBinaryValued- Returns:
- a reference to the
byte[]holding the contained value. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
asInet4Address
public Inet4Address asInet4Address()
Description copied from interface:Ip4AddressValuedGets the contained IP address as an Inet4Address.- Specified by:
asInet4Addressin interfaceIp4AddressValued- Returns:
- the contained value as a
Inet4Address. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
asInet6Address
public Inet6Address asInet6Address()
Description copied from interface:Ip6AddressValuedGets the contained IP address as an Inet6Address.- Specified by:
asInet6Addressin interfaceIp6AddressValued- Returns:
- the contained value as a
Inet6Address. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
asAddress
public byte[] asAddress()
Description copied from interface:Ip4AddressValuedGets the contained raw IPv4 address value. The array returned is a copy of the binary data contained in the object.- Specified by:
asAddressin interfaceIp4AddressValued- Specified by:
asAddressin interfaceIp6AddressValued- Returns:
- the contained value as a
byte[4]. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
asPeriod
public Period asPeriod()
Description copied from interface:PeriodValuedGets the contained Period value as ajava.time.Period.- Specified by:
asPeriodin interfacePeriodValued- Returns:
- the contained value as a
java.time.Period. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
getYears
public int getYears()
Description copied from interface:PeriodValuedGets the year portion of the contained period value.- Specified by:
getYearsin interfacePeriodValued- Returns:
- the year portion of the contained value
If null valued, as indicated by
TokenValued.isNull(),0is returned.
-
getMonths
public int getMonths()
Description copied from interface:PeriodValuedGets the month portion of the contained period value. This does not include the year portion.- Specified by:
getMonthsin interfacePeriodValued- Returns:
- the month portion of the contained value
If null valued, as indicated by
TokenValued.isNull(),0is returned.
-
getDays
public int getDays()
Description copied from interface:PeriodValuedGets the day portion of the contained period value. This does not include the year or month portion.- Specified by:
getDaysin interfacePeriodValued- Returns:
- the day portion of the contained value
If null valued, as indicated by
TokenValued.isNull(),0is returned.
-
asDuration
public Duration asDuration()
Description copied from interface:DurationValuedGets the contained Duration value as ajava.time.Duration.- Specified by:
asDurationin interfaceDurationValued- Returns:
- the contained value as a
java.time.Duration. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
asSeconds
public long asSeconds()
Description copied from interface:DurationValuedGet the contained duration value as the number of seconds.- Specified by:
asSecondsin interfaceDurationValued- Returns:
- the contained value as seconds.
If null valued, as indicated by
TokenValued.isNull(),0is returned. - See Also:
DurationValued.subsecNanos()
-
asCents
public long asCents()
Description copied from interface:MoneyValuedGets the contained cents value as a long- Specified by:
asCentsin interfaceMoneyValued- Returns:
- the contained cents value as a
long. If null valued, as indicated byTokenValued.isNull(),0is returned.
-
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
-
-