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:
-
Field Summary
FieldsFields inherited from interface com.pervasive.datarush.tokens.scalar.NumericValued
MAX_INFINITY, MIN_INFINITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Gets the contained raw IPv4 address value.Gets the contained numeric value.byte[]asBinary()Gets the contained binary value.byte[]Gets a reference to the contained binary value.booleanGets the contained boolean value.Gets the contained date value.longasCents()Gets the contained cents value as a longcharasChar()Gets the contained character value.asDate()Gets the contained date value as ajava.sql.Daterelative to the default time zone.Gets the contained date value as ajava.sql.Daterelative to the given time zone.intGets the contained time value as the number of milliseconds elapsed since midnight.doubleasDouble()Gets the contained double value.Gets the contained Duration value as ajava.time.Duration.longGets the contained date value as the number of days since Java epoch (January 1, 1970).longGets 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.Gets the contained IP address as an Inet4Address.Gets the contained IP address as an Inet6Address.intasInt()Gets the contained integer value.longasLong()Gets the contained long value.asPeriod()Gets the contained Period value as ajava.time.Period.longGet the contained duration value as the number of seconds.asString()Gets the contained string value.Gets the contained time value.Gets the contained timestamp value as ajava.sql.Timestamprelative to the default time zone.intbooleanIndicates whether another object is equal to this token.intgetDays()Gets the day portion of the contained period value.intGets the month portion of the contained period value.getType()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.final booleanisNull()Indicates whether the token is null valued.booleanisZero()Indicates whether the value is the zero value for the type.intGets the time zone and daylight saving time offset of the contained timestamp value, in seconds.intGets the subsecond portion of the contained timestamp value.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.pervasive.datarush.tokens.TokenValued
isNull
-
Field Details
-
NULL
A null valuedNullToken
-
-
Constructor Details
-
NullToken
protected NullToken()
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<NullToken>
-
equals
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
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
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
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:
-
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:
-
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:
-
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
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
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
Description copied from interface:DateValuedGets the contained date value as ajava.sql.Daterelative to the default time zone. The time zone id used by {@link ZoneId.systemDefault()} 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
Description copied from interface:DateValuedGets the contained date value as ajava.sql.Daterelative to the given time zone.- Specified by:
asDatein interfaceDateValued- Parameters:
zoneId- the time zone id 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
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
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
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
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
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:
-
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
-