public class TokenTypeConstant extends Object
record(Field...)
.Modifier and Type | Field and Description |
---|---|
static ScalarTokenType |
BINARY
A description of the binary token type.
|
static ScalarTokenType |
BOOLEAN
A description of the boolean token type.
|
static ScalarTokenType |
CHAR
A description of the character token type.
|
static ScalarTokenType |
DATE
A description of the date token type.
|
static ScalarTokenType |
DOUBLE
A description of the double token type.
|
static ScalarTokenType |
DURATION
A description of the duration token type.
|
static ScalarTokenType |
FLOAT
A description of the float token type.
|
static GenericTokenType |
GENERIC
An abstract type representing any type.
|
static ScalarTokenType |
INT
A description of the integer token type.
|
static ScalarTokenType |
IP4ADDRESS
A description of the ip4address token type.
|
static ScalarTokenType |
IP6ADDRESS
A description of the ip6address token type.
|
static ScalarTokenType |
LONG
A description of the long token type.
|
static ScalarTokenType |
MONEY
A description of the money token type.
|
static ScalarTokenType |
NULL
A description of the null token type.
|
static ScalarTokenType |
NUMERIC
A description of the numeric token type.
|
static ScalarTokenType |
PERIOD
A description of the period token type.
|
static RecordTokenType |
RECORD
An abstract type representing any record type.
|
static ScalarTokenType |
SCALAR
An abstract type representing any scalar type.
|
static ScalarTokenType |
STRING
A description of the string token type.
|
static ScalarTokenType |
TIME
A description of the time token type.
|
static ScalarTokenType |
TIMESTAMP
A description of the timestamp token type.
|
Modifier and Type | Method and Description |
---|---|
static Field |
BINARY(String name)
Constructs a binary typed field with the given name.
|
static Field |
BOOLEAN(String name)
Constructs a boolean typed field with the given name.
|
static Field |
CHAR(String name)
Constructs a character typed field with the given name.
|
static Field |
DATE(String name)
Constructs a date typed field with the given name.
|
static Field |
domain(Field field,
FieldDomain domain)
Returns a new field object with the same type and name as the original, but
with the domain set to the given value.
|
static Field |
DOMAIN(Field field,
String... values)
Creates a field with the domain set to the given values
|
static FieldDomain |
DOMAIN(String... values)
Creates a field domain with the domain set to the given values
|
static Field |
DOUBLE(String name)
Constructs a double typed field with the given name.
|
static Field |
DURATION(String name)
Constructs a duration typed field with the given name.
|
static <O> ObjectTokenType<O> |
EXTENDED(Class<O> type,
String extendedType)
Gets a description of an extended object token type.
|
static Field |
field(ScalarTokenType type,
String name)
Constructs a field with the given name of the
specified type.
|
static Field |
FLOAT(String name)
Constructs a float typed field with the given name.
|
static ScalarTokenType |
getScalar(String name)
Gets the constant scalar token type descriptor for the specified name.
|
static Field |
INT(String name)
Constructs a integer typed field with the given name.
|
static Field |
IP4ADDRESS(String name)
Constructs a ip4address typed field with the given name.
|
static Field |
IP6ADDRESS(String name)
Constructs a ip6address typed field with the given name.
|
static Field |
LONG(String name)
Constructs a long typed field with the given name.
|
static Field |
MONEY(String name)
Constructs a money typed field with the given name.
|
static Field |
NUMERIC(String name)
Constructs a numeric typed field with the given name.
|
static <O> ObjectTokenType<O> |
OBJECT(Class<O> type)
Gets a description of an object token type.
|
static <O> Field |
OBJECT(Class<O> type,
String name)
Constructs an object typed field with the given name.
|
static <O> ObjectTokenType<O> |
PARAMETERIZED(Class<O> type,
String extendedType,
Type... genericParams)
Gets a description of an parameterized object token type.
|
static <O> Field |
PARAMETERIZED(Class<O> type,
String extendedType,
Type[] genericParams,
String name)
Constructs an object typed field with the given name.
|
static Field |
PERIOD(String name)
Constructs a period typed field with the given name.
|
static RecordTokenType |
record(Field... fields)
Constructs a record type descriptor with the given fields.
|
static ScalarTokenType[] |
scalars()
Gets the descriptors for all supported scalar token types.
|
static RecordTokenType |
sparseRecord(Field... fields)
Constructs a record type descriptor with the given fields.
|
static Field |
STRING(String name)
Constructs a string typed field with the given name.
|
static Field |
STRING(String name,
List<String> values)
Constructs a string typed field with the given name.
|
static Field |
STRING(String name,
String... values)
Constructs a string typed field with the given name.
|
static Field |
TIME(String name)
Constructs a time typed field with the given name.
|
static Field |
TIMESTAMP(String name)
Constructs a timestamp typed field with the given name.
|
static TokenType[] |
values()
Gets the descriptors for all supported token types.
|
public static final GenericTokenType GENERIC
public static final ScalarTokenType SCALAR
public static final ScalarTokenType BINARY
Binary tokens are a variable length type, corresponding to Java
byte[]
.
public static final ScalarTokenType BOOLEAN
Boolean tokens correspond to the Java boolean
primitive type.
public static final ScalarTokenType CHAR
Character tokens correspond to the Java char
primitive type.
public static final ScalarTokenType DURATION
Duration tokens correspond to the Java Duration
type.
public static final ScalarTokenType DATE
Date tokens correspond to the JDBC Date
type.
public static final ScalarTokenType IP4ADDRESS
Ip4address tokens correspond to the Inet4Address
type.
public static final ScalarTokenType IP6ADDRESS
Ip4address tokens correspond to the Inet4Address
type.
public static final ScalarTokenType INT
Integer tokens correspond to the Java int
primitive type.
public static final ScalarTokenType LONG
Long tokens correspond to the Java long
primitive type.
public static final ScalarTokenType MONEY
money tokens are represented as a decimal with a scale of 2.
public static final ScalarTokenType NULL
A null token type cannot contain any data. It is assignable to any other scalar type.
public static final ScalarTokenType NUMERIC
Numeric data is represented as BigDecimal
objects.
The numeric data type can be useful to represent floating point data that
cannot tolerate possible rounding errors encountered with Java
double
or float
primitive data types.
public static final ScalarTokenType FLOAT
Float tokens correspond to the Java float
primitive type.
public static final ScalarTokenType DOUBLE
Double tokens correspond to the Java double
primitive type.
public static final ScalarTokenType PERIOD
Period tokens correspond to the Java Period
type.
public static final ScalarTokenType STRING
String tokens are a variable length type, corresponding to
String
.
public static final ScalarTokenType TIME
public static final ScalarTokenType TIMESTAMP
Timestamp tokens correspond to the JDBC Timestamp
type.
public static final RecordTokenType RECORD
To construct a concrete record token type, use the record(Field...)
method
or RecordTokenTypeBuilder
class.
public static Field field(ScalarTokenType type, String name)
This method is used in conjunction with record(Field...)
to construct record types.
type
- the token type of the fieldname
- the name of the fieldpublic static Field BINARY(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field BOOLEAN(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field CHAR(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field DURATION(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field DATE(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field IP4ADDRESS(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field IP6ADDRESS(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field INT(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field LONG(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field MONEY(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field NUMERIC(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static <O> ObjectTokenType<O> OBJECT(Class<O> type)
Object tokens are of indeterminate length, corresponding to Java
Object
.
O
- the object typetype
- the Class
object for the type of Java objects the
token type describesObjectTokenType
for the specified class.public static <O> ObjectTokenType<O> EXTENDED(Class<O> type, String extendedType)
Object tokens are of indeterminate length, corresponding to Java
Object
.
O
- the object typetype
- the Class
object for the type of Java objects the
token type describesextendedType
- the extended type if for the typeObjectTokenType
for the specified class.public static <O> ObjectTokenType<O> PARAMETERIZED(Class<O> type, String extendedType, Type... genericParams)
Object tokens are of indeterminate length, corresponding to Java
Object
.
O
- the object typetype
- the Class
object for the type of Java objects the
token type describesextendedType
- the extended type if for the typegenericParams
- the ordered Class
objects for the generic
type parameters of the object token typeObjectTokenType
for the specified class.public static <O> Field OBJECT(Class<O> type, String name)
This method is used in conjunction with record(Field...)
to construct record types.
O
- the object typetype
- the Class
object for the type of the Java objects
in the fieldname
- the name of the fieldpublic static <O> Field PARAMETERIZED(Class<O> type, String extendedType, Type[] genericParams, String name)
This method is used in conjunction with record(Field...)
to construct record types.
O
- the object typetype
- the Class
object for the type of the Java objects
in the fieldname
- the name of the fieldpublic static Field FLOAT(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field DOUBLE(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field PERIOD(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field STRING(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field STRING(String name, String... values)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldvalues
- the domain of the string fieldpublic static Field STRING(String name, List<String> values)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldvalues
- the domain of the string fieldpublic static Field TIME(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static Field TIMESTAMP(String name)
This method is used in conjunction with record(Field...)
to construct record types.
name
- the name of the fieldpublic static RecordTokenType record(Field... fields)
This method, in conjunction with the Field
factory methods
in this class, provides a convenient and concise way of statically
specifying record type schemas. An example of this follows:
import static com.pervasive.tokens.type.TokenTypeConstant.RECORD; import static com.pervasive.tokens.type.TokenTypeConstant.INT; import static com.pervasive.tokens.type.TokenTypeConstant.STRING; import static com.pervasive.tokens.type.TokenTypeConstant.TIMESTAMP; public static final RecordTokenType ORDER_RECORD= RECORD(INT("orderId"), STRING("customer"), TIMESTAMP("orderDate"));This defines a record type for a hypothetical order processing system. Each record contains an integer order ID, a string with customer name, and a timestamp with the order date.
If no fields are providide, this yields the abstract record type.
fields
- the fields describing the schema of this record typepublic static Field domain(Field field, FieldDomain domain)
field
- The fielddomain
- The value domainpublic static Field DOMAIN(Field field, String... values)
field
- the field. must be a string fieldvalues
- the string values in the domainIllegalArgumentException
- if the field is not a string fieldpublic static FieldDomain DOMAIN(String... values)
values
- the string values in the domainpublic static RecordTokenType sparseRecord(Field... fields)
This method, in conjunction with the Field
factory methods
in this class, provides a convenient and concise way of statically
specifying record type schemas. An example of this follows:
import static com.pervasive.tokens.type.TokenTypeConstant.RECORD; import static com.pervasive.tokens.type.TokenTypeConstant.INT; import static com.pervasive.tokens.type.TokenTypeConstant.STRING; import static com.pervasive.tokens.type.TokenTypeConstant.TIMESTAMP; public static final RecordTokenType ORDER_RECORD= RECORD(INT("orderId"), STRING("customer"), TIMESTAMP("orderDate"), RECORD("lineItems", INT("itemId"), INT("count")));This defines a nested record type for a hypothetical order processing system. Each record contains an integer order ID, a string with customer name, a timestamp with the order date, and nested line items, each with an integer count and item ID.
fields
- the fields describing the schema of this record typepublic static TokenType[] values()
public static ScalarTokenType[] scalars()
public static ScalarTokenType getScalar(String name)
name
- the scalar type for which to get the type descriptorCopyright © 2020 Actian Corporation. All rights reserved.