public final class StringToken extends Object implements ScalarToken, Comparable<StringToken>
StringValued
object.Modifier and Type | Field and Description |
---|---|
static StringToken |
NULL
A null valued
StringToken |
static StringToken |
ZERO
A zero valued
StringToken |
static String |
ZERO_VALUE
The string representing a zero value, the empty string.
|
Constructor and Description |
---|
StringToken(String value)
Constructs an new token with the given non-null
string.
|
StringToken(StringValued value)
Constructs a new token with the string
value in the given container.
|
Modifier and Type | Method and Description |
---|---|
String |
asString()
Gets the contained string value.
|
int |
compareTo(StringToken that) |
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.
|
static StringToken |
parse(String value)
Converts a string into a token.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getType, isZero
isNull
public static final StringToken NULL
StringToken
public static final String ZERO_VALUE
public static final StringToken ZERO
StringToken
public StringToken(StringValued value)
value
- a StringValued
containing the
desired valuepublic StringToken(String value)
NULL
.value
- the string value of the tokenNullPointerException
- if the value is null
.public int compareTo(StringToken that)
compareTo
in interface Comparable<StringToken>
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 StringToken parse(String value)
value
- the string value of the tokenpublic ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public final String asString()
StringValued
asString
in interface StringValued
String
.
If null valued, as indicated by TokenValued.isNull()
, the empty
string (""
) is returned.public boolean isZero()
ScalarValued
isZero
in interface ScalarValued
true
if the value is the zero value,
false
otherwise.public final boolean isNull()
TokenValued
isNull
in interface TokenValued
true
if the token is null valued,
false
otherwiseCopyright © 2016 Actian Corporation. All rights reserved.