-
public interface TokenConverter
An object capable of converting tokens into other formats. While the interface is generically typed, usingTokenValued
, implementations are generally type specific, working on only tokens of one type.- See Also:
TokenConverters
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
asHashCode()
Computes a hash code for the source token value.Object
asObject()
Creates anObject
representation of the source value.String
asString()
Creates a string representation of the source value, suitable for displaying to users.DataToken
asToken()
Creates an immutable copy of the source value.void
setSource(TokenValued value)
Sets the source value for this converter.
-
-
-
Method Detail
-
setSource
void setSource(TokenValued value)
Sets the source value for this converter.- Parameters:
value
- the source of values to be converted
-
asToken
DataToken asToken()
Creates an immutable copy of the source value.- Returns:
- an immutable token holding the same token value
-
asObject
Object asObject()
Creates anObject
representation of the source value. The type of the object returned depends on the token type.Token Type Object Type BINARY byte array BOOLEAN Boolean
CHAR Character
DATE Date
(time portion will be midnight)DOUBLE Double
ENUM String
FLOAT Float
INT Integer
IP4ADDRESS Inet4Address
IP6ADDRESS Inet6Address
LONG Long
NUMERIC BigDecimal
OBJECT Object
RECORD Map
STRING String
TIMESTAMP Date
(date portion will by January 1, 1970)TIMESTAMP Timestamp
A
null
object reference is returned if the current token value is null.- Returns:
- an
Object
containing the current token value
-
asString
String asString()
Creates a string representation of the source value, suitable for displaying to users.- Returns:
- the formatted value
-
asHashCode
int asHashCode()
Computes a hash code for the source token value. Two token values reported equal byTokenComparator.equal()
will always generate the same hash code.- Returns:
- a computed hash code for the value
-
-