public class NullToken extends Object implements ScalarToken, Comparable<NullToken>, BinaryValued, BooleanValued, CharValued, DateValued, IntValued, StringValued, TimeValued, TimestampValued
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 |
---|---|
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.
|
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.
|
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.
|
int |
asInt()
Gets the contained integer value.
|
long |
asLong()
Gets the contained long value.
|
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.
|
ScalarTokenType |
getType()
Gets the data type of the token.
|
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 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 final boolean isNull()
TokenValued
isNull
in interface TokenValued
true
if the token is null valued,
false
otherwiseCopyright © 2016 Actian Corporation. All rights reserved.