public final class BooleanToken extends Object implements ScalarToken, Comparable<BooleanToken>
BooleanValued
object.Modifier and Type | Field and Description |
---|---|
static BooleanToken |
FALSE
A
BooleanToken with a value of false |
static BooleanToken |
NULL
A null valued
BooleanToken |
static BooleanToken |
TRUE
A
BooleanToken with a value of true |
static BooleanToken |
ZERO
A zero valued
BooleanToken |
static boolean |
ZERO_VALUE
The boolean representing a zero value,
false . |
Constructor and Description |
---|
BooleanToken(boolean value)
Constructs a new token with the given non-null
boolean value.
|
BooleanToken(BooleanValued value)
Constructs a new token with the boolean
value in the given container.
|
Modifier and Type | Method and Description |
---|---|
boolean |
asBoolean()
Gets the contained boolean value.
|
Boolean |
asObject()
Gets the value of the token as an object.
|
int |
compareTo(BooleanToken that) |
boolean |
equals(Object obj)
Indicates whether another object is equal to this token.
|
static BooleanToken |
getToken(boolean value)
Returns a token with the given non-null value boolean value.
|
static BooleanToken |
getToken(BooleanValued value)
Returns a token with the boolean value in the given container.
|
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.
|
static BooleanToken |
parse(String value)
Converts a string representation of a boolean value into
a token.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getType, isZero
isNull
public static final BooleanToken NULL
BooleanToken
public static final BooleanToken TRUE
BooleanToken
with a value of true
public static final BooleanToken FALSE
BooleanToken
with a value of false
public static final boolean ZERO_VALUE
false
.public static final BooleanToken ZERO
BooleanToken
public BooleanToken(BooleanValued value)
It is generally preferable to use getToken(BooleanValued)
instead.
value
- a BooleanValued
containing the
desired valuepublic BooleanToken(boolean value)
NULL
.
It is generally preferable to use getToken(boolean)
instead.
value
- the boolean value of the tokenpublic static BooleanToken getToken(BooleanValued value)
value
- a BooleanValued
containing the
desired valuepublic static BooleanToken getToken(boolean value)
value
- the boolean value of the tokenpublic Boolean asObject()
null
if the token is null valued.public int compareTo(BooleanToken that)
compareTo
in interface Comparable<BooleanToken>
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 static BooleanToken parse(String value)
value
- a string value to interpret as a boolean;
see Boolean.valueOf(String)
.public final ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public final boolean isZero()
ScalarValued
isZero
in interface ScalarValued
true
if the value is the zero value,
false
otherwise.public final boolean asBoolean()
BooleanValued
asBoolean
in interface BooleanValued
boolean
. If null valued,
as indicated by TokenValued.isNull()
, false
is returned.public final boolean isNull()
TokenValued
isNull
in interface TokenValued
true
if the token is null valued,
false
otherwiseCopyright © 2020 Actian Corporation. All rights reserved.