public class NullToken extends Object implements ScalarToken, Comparable<NullToken>, BinaryValued, BooleanValued, CharValued, DateValued, IntValued, StringValued, TimeValued, TimestampValued, MoneyValued, DurationValued, PeriodValued, Ip4AddressValued, Ip6AddressValued
Modifier and Type | Field and Description |
---|---|
static NullToken |
NULL
A null valued
NullToken |
MAX_INFINITY, MIN_INFINITY
Modifier | Constructor and Description |
---|---|
protected |
NullToken() |
Modifier and Type | Method and Description |
---|---|
byte[] |
asAddress()
Gets the contained raw IPv4 address value.
|
BigDecimal |
asBigDecimal()
Gets the contained numeric value.
|
byte[] |
asBinary()
Gets the contained binary value.
|
byte[] |
asBinaryRef()
Gets a reference to the contained binary value.
|
boolean |
asBoolean()
Gets the contained boolean value.
|
CalendarDate |
asCalendarDate()
Gets the contained date value.
|
long |
asCents()
Gets the contained cents value as a long
|
char |
asChar()
Gets the contained character value.
|
Date |
asDate()
Gets the contained date value as a
java.sql.Date
relative to the default time zone. |
Date |
asDate(TimeZone tz)
Gets the contained date value as a
java.sql.Date
relative to the given time zone. |
int |
asDayMillis()
Gets the contained time value as the number of milliseconds
elapsed since midnight.
|
double |
asDouble()
Gets the contained double value.
|
Duration |
asDuration()
Gets the contained Duration value as a
java.time.Duration . |
long |
asEpochDays()
Gets the contained date value as the number of days since
Java epoch (January 1, 1970).
|
long |
asEpochSecs()
Gets the contained timestamp value as the number of seconds since
Java epoch (January 1, 1970 00:00:00 GMT).
|
float |
asFloat()
Gets the contained float value.
|
Inet4Address |
asInet4Address()
Gets the contained IP address as an Inet4Address.
|
Inet6Address |
asInet6Address()
Gets the contained IP address as an Inet6Address.
|
int |
asInt()
Gets the contained integer value.
|
long |
asLong()
Gets the contained long value.
|
Period |
asPeriod()
Gets the contained Period value as a
java.time.Period . |
long |
asSeconds()
Get the contained duration value as the number of seconds.
|
String |
asString()
Gets the contained string value.
|
TimeOfDay |
asTimeOfDay()
Gets the contained time value.
|
Timestamp |
asTimestamp()
Gets the contained timestamp value as a
java.sql.Timestamp
relative to the default time zone. |
int |
compareTo(NullToken o) |
boolean |
equals(Object obj)
Indicates whether another object is equal to this token.
|
int |
getDays()
Gets the day portion of the contained period value.
|
int |
getMonths()
Gets the month portion of the contained period value.
|
ScalarTokenType |
getType()
Gets the data type of the token.
|
int |
getYears()
Gets the year portion of the contained period value.
|
int |
hashCode()
Returns a hash code for the token.
|
boolean |
isNull()
Indicates whether the token is null valued.
|
boolean |
isZero()
Indicates whether the value is the zero value
for the type.
|
int |
offsetSecs()
Gets the time zone and daylight saving time offset of the contained
timestamp value, in seconds.
|
int |
subsecNanos()
Gets the subsecond portion of the contained timestamp value.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
isNull
public static final NullToken NULL
NullToken
public int compareTo(NullToken o)
compareTo
in interface Comparable<NullToken>
public boolean equals(Object obj)
DataToken
TokenComparator.equal(TokenValued,TokenValued)
but makes it possible to store DataToken
s in Map
s.public int hashCode()
DataToken
TokenConverter.asHashCode(TokenValued)
.public ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public boolean isZero()
ScalarValued
isZero
in interface ScalarValued
true
if the value is the zero value,
false
otherwise.public double asDouble()
DoubleValued
asDouble
in interface DoubleValued
double
. If null valued,
as indicated by TokenValued.isNull()
, Double.NaN
is returned.public BigDecimal asBigDecimal()
NumericValued
asBigDecimal
in interface NumericValued
java.math.BigDecimal
.
If null valued, as indicated by TokenValued.isNull()
, null
is returned.public long asLong()
LongValued
asLong
in interface LongValued
long
. If null valued,
as indicated by TokenValued.isNull()
, 0
is returned.public float asFloat()
FloatValued
asFloat
in interface FloatValued
float
. If null valued,
as indicated by TokenValued.isNull()
, Float.NaN
is returned.public Timestamp asTimestamp()
TimestampValued
java.sql.Timestamp
relative to the default time zone. The time zone used by
TimeZone#getDefault()
is used.asTimestamp
in interface TimestampValued
java.sql.Timestamp
.
If null valued, as indicated by TokenValued.isNull()
,
null
is returned.public long asEpochSecs()
TimestampValued
subsecNanos()
in conjunction with this method.asEpochSecs
in interface TimestampValued
TokenValued.isNull()
,
0
is returned.TimestampValued.subsecNanos()
public int subsecNanos()
TimestampValued
asEpochSecs()
. Thus the value asEpochSecs()
* 1000000000 + subsecNanos()
represents the number of
nanoseconds since Java epoch.subsecNanos
in interface DurationValued
subsecNanos
in interface TimestampValued
TokenValued.isNull()
,
0
is returned.TimestampValued.asEpochSecs()
public int offsetSecs()
TimestampValued
offsetSecs
in interface TimestampValued
TokenValued.isNull()
, 0
is returned.TimestampValued.asEpochSecs()
public int asDayMillis()
TimeValued
asDayMillis
in interface TimeValued
TokenValued.isNull()
,
0
is returned.public TimeOfDay asTimeOfDay()
TimeValued
asTimeOfDay
in interface TimeValued
TokenValued.isNull()
,
null
is returned.public String asString()
StringValued
asString
in interface StringValued
String
.
If null valued, as indicated by TokenValued.isNull()
, the empty
string (""
) is returned.public int asInt()
IntValued
asInt
in interface IntValued
int
. If null valued,
as indicated by TokenValued.isNull()
, 0
is returned.public Date asDate()
DateValued
java.sql.Date
relative to the default time zone. The time zone used by
TimeZone.getDefault()
is used.asDate
in interface DateValued
java.sql.Date
.
If null valued, as indicated by TokenValued.isNull()
,
null
is returned.public Date asDate(TimeZone tz)
DateValued
java.sql.Date
relative to the given time zone.asDate
in interface DateValued
tz
- the time zone in which to interpret the datejava.sql.Date
.
If null valued, as indicated by TokenValued.isNull()
,
null
is returned.public long asEpochDays()
DateValued
asEpochDays
in interface DateValued
TokenValued.isNull()
,
0
is returned.public CalendarDate asCalendarDate()
DateValued
asCalendarDate
in interface DateValued
TokenValued.isNull()
,
null
is returned.public char asChar()
CharValued
asChar
in interface CharValued
char
. If null valued,
as indicated by TokenValued.isNull()
, Character.MAX_VALUE
is returned.public boolean asBoolean()
BooleanValued
asBoolean
in interface BooleanValued
boolean
. If null valued,
as indicated by TokenValued.isNull()
, false
is returned.public byte[] asBinary()
BinaryValued
The array returned is a copy of the binary data contained in
the object. To avoid this overhead, use BinaryValued.asBinaryRef()
instead.
asBinary
in interface BinaryValued
byte[]
. If
null valued, as indicated by TokenValued.isNull()
,
null
is returned.public byte[] asBinaryRef()
BinaryValued
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.
asBinaryRef
in interface BinaryValued
byte[]
holding the contained
value. If null valued, as indicated by TokenValued.isNull()
,
null
is returned.public Inet4Address asInet4Address()
Ip4AddressValued
asInet4Address
in interface Ip4AddressValued
Inet4Address
. If null valued,
as indicated by TokenValued.isNull()
, null
is returned.public Inet6Address asInet6Address()
Ip6AddressValued
asInet6Address
in interface Ip6AddressValued
Inet6Address
. If null valued,
as indicated by TokenValued.isNull()
, null
is returned.public byte[] asAddress()
Ip4AddressValued
asAddress
in interface Ip4AddressValued
asAddress
in interface Ip6AddressValued
byte[4]
. If null valued,
as indicated by TokenValued.isNull()
, null
is returned.public Period asPeriod()
PeriodValued
java.time.Period
.asPeriod
in interface PeriodValued
java.time.Period
. If null valued,
as indicated by TokenValued.isNull()
, null
is returned.public int getYears()
PeriodValued
getYears
in interface PeriodValued
TokenValued.isNull()
,
0
is returned.public int getMonths()
PeriodValued
getMonths
in interface PeriodValued
TokenValued.isNull()
,
0
is returned.public int getDays()
PeriodValued
getDays
in interface PeriodValued
TokenValued.isNull()
,
0
is returned.public Duration asDuration()
DurationValued
java.time.Duration
.asDuration
in interface DurationValued
java.time.Duration
. If null valued,
as indicated by TokenValued.isNull()
, null
is returned.public long asSeconds()
DurationValued
asSeconds
in interface DurationValued
TokenValued.isNull()
,
0
is returned.DurationValued.subsecNanos()
public long asCents()
MoneyValued
asCents
in interface MoneyValued
long
. If null valued,
as indicated by TokenValued.isNull()
, 0
is returned.public final boolean isNull()
TokenValued
isNull
in interface TokenValued
true
if the token is null valued,
false
otherwiseCopyright © 2019 Actian Corporation. All rights reserved.