record(Field...).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ScalarTokenTypeA description of the binary token type.static final ScalarTokenTypeA description of the boolean token type.static final ScalarTokenTypeA description of the character token type.static final ScalarTokenTypeA description of the date token type.static final ScalarTokenTypeA description of the double token type.static final ScalarTokenTypeA description of the duration token type.static final ScalarTokenTypeA description of the float token type.static final GenericTokenTypeAn abstract type representing any type.static final ScalarTokenTypeA description of the integer token type.static final ScalarTokenTypeA description of the ip4address token type.static final ScalarTokenTypeA description of the ip6address token type.static final ScalarTokenTypeA description of the long token type.static final ScalarTokenTypeA description of the money token type.static final ScalarTokenTypeA description of the null token type.static final ScalarTokenTypeA description of the numeric token type.static final ScalarTokenTypeA description of the period token type.static final RecordTokenTypeAn abstract type representing any record type.static final ScalarTokenTypeAn abstract type representing any scalar type.static final ScalarTokenTypeA description of the string token type.static final ScalarTokenTypeA description of the time token type.static final ScalarTokenTypeA description of the timestamp token type. -
Method Summary
Modifier and TypeMethodDescriptionstatic FieldConstructs a binary typed field with the given name.static FieldConstructs a boolean typed field with the given name.static FieldConstructs a character typed field with the given name.static FieldConstructs a date typed field with the given name.static Fielddomain(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 FieldCreates a field with the domain set to the given valuesstatic FieldDomainCreates a field domain with the domain set to the given valuesstatic FieldConstructs a double typed field with the given name.static FieldConstructs a duration typed field with the given name.static <O> ObjectTokenType<O>Gets a description of an extended object token type.static Fieldfield(ScalarTokenType type, String name) Constructs a field with the given name of the specified type.static FieldConstructs a float typed field with the given name.static ScalarTokenTypeGets the constant scalar token type descriptor for the specified name.static FieldConstructs a integer typed field with the given name.static FieldIP4ADDRESS(String name) Constructs a ip4address typed field with the given name.static FieldIP6ADDRESS(String name) Constructs a ip6address typed field with the given name.static FieldConstructs a long typed field with the given name.static FieldConstructs a money typed field with the given name.static FieldConstructs a numeric typed field with the given name.static <O> ObjectTokenType<O>Gets a description of an object token type.static <O> FieldConstructs 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> FieldPARAMETERIZED(Class<O> type, String extendedType, Type[] genericParams, String name) Constructs an object typed field with the given name.static FieldConstructs a period typed field with the given name.static RecordTokenTypeConstructs a record type descriptor with the given fields.static ScalarTokenType[]scalars()Gets the descriptors for all supported scalar token types.static RecordTokenTypesparseRecord(Field... fields) Constructs a record type descriptor with the given fields.static FieldConstructs a string typed field with the given name.static FieldConstructs a string typed field with the given name.static FieldConstructs a string typed field with the given name.static FieldConstructs a time typed field with the given name.static FieldConstructs a timestamp typed field with the given name.static TokenType[]values()Gets the descriptors for all supported token types.
-
Field Details
-
GENERIC
An abstract type representing any type. It is assignable from any type, but is not equal to any. This type can be used as a placeholder for a more concrete type. -
SCALAR
An abstract type representing any scalar type. It is assignable from any scalar type, but is not equal to any. This type can be used as a placeholder for a more concrete scalar type. -
BINARY
A description of the binary token type.Binary tokens are a variable length type, corresponding to Java
byte[]. -
BOOLEAN
A description of the boolean token type.Boolean tokens correspond to the Java
booleanprimitive type. -
CHAR
A description of the character token type.Character tokens correspond to the Java
charprimitive type. -
DURATION
A description of the duration token type.Duration tokens correspond to the Java
Durationtype. -
DATE
A description of the date token type. A date represents a specific calendar date: a day, month, and year.Date tokens correspond to the JDBC
Datetype. -
IP4ADDRESS
A description of the ip4address token type. An ip4address represents an IPv4 address.Ip4address tokens correspond to the
Inet4Addresstype. -
IP6ADDRESS
A description of the ip6address token type. An ip6address represents an IPv6 address.Ip4address tokens correspond to the
Inet4Addresstype. -
INT
A description of the integer token type.Integer tokens correspond to the Java
intprimitive type. -
LONG
A description of the long token type.Long tokens correspond to the Java
longprimitive type. -
MONEY
A description of the money token type.money tokens are represented as a decimal with a scale of 2.
-
NULL
A description of the null token type.A null token type cannot contain any data. It is assignable to any other scalar type.
-
NUMERIC
A description of the numeric token type.Numeric data is represented as
BigDecimalobjects. The numeric data type can be useful to represent floating point data that cannot tolerate possible rounding errors encountered with Javadoubleorfloatprimitive data types. -
FLOAT
A description of the float token type.Float tokens correspond to the Java
floatprimitive type. -
DOUBLE
A description of the double token type.Double tokens correspond to the Java
doubleprimitive type. -
PERIOD
A description of the period token type.Period tokens correspond to the Java
Periodtype. -
STRING
A description of the string token type.String tokens are a variable length type, corresponding to
String. -
TIME
A description of the time token type. A time represents an specific time of day (hour, minute, second) with millisecond precision. -
TIMESTAMP
A description of the timestamp token type. A timestamp represents an instance in time, containing both date (day, month, year) and time information with nanosecond precision.Timestamp tokens correspond to the JDBC
Timestamptype. -
RECORD
An abstract type representing any record type. It is assignable from any record type, but is not equal to any. This type can be used as a placeholder for a more concrete record type.To construct a concrete record token type, use the
record(Field...)method orRecordTokenTypeBuilderclass.
-
-
Method Details
-
field
Constructs a field with the given name of the specified type.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
type- the token type of the fieldname- the name of the field- Returns:
- a field of the specified type with the given name.
-
BINARY
Constructs a binary typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of binary type with the given name.
-
BOOLEAN
Constructs a boolean typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of boolean type with the given name.
-
CHAR
Constructs a character typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of character type with the given name.
-
DURATION
Constructs a duration typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of duration type with the given name.
-
DATE
Constructs a date typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of date type with the given name.
-
IP4ADDRESS
Constructs a ip4address typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of ip4address type with the given name.
-
IP6ADDRESS
Constructs a ip6address typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of ip6address type with the given name.
-
INT
Constructs a integer typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of integer type with the given name.
-
LONG
Constructs a long typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of long type with the given name.
-
MONEY
Constructs a money typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of money type with the given name.
-
NUMERIC
Constructs a numeric typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of numeric type with the given name.
-
OBJECT
Gets a description of an object token type.Object tokens are of indeterminate length, corresponding to Java
Object.- Type Parameters:
O- the object type- Parameters:
type- theClassobject for the type of Java objects the token type describes- Returns:
- an
ObjectTokenTypefor the specified class.
-
EXTENDED
Gets a description of an extended object token type.Object tokens are of indeterminate length, corresponding to Java
Object.- Type Parameters:
O- the object type- Parameters:
type- theClassobject for the type of Java objects the token type describesextendedType- the extended type if for the type- Returns:
- an
ObjectTokenTypefor the specified class.
-
PARAMETERIZED
public static <O> ObjectTokenType<O> PARAMETERIZED(Class<O> type, String extendedType, Type... genericParams) Gets a description of an parameterized object token type.Object tokens are of indeterminate length, corresponding to Java
Object.- Type Parameters:
O- the object type- Parameters:
type- theClassobject for the type of Java objects the token type describesextendedType- the extended type if for the typegenericParams- the orderedClassobjects for the generic type parameters of the object token type- Returns:
- an
ObjectTokenTypefor the specified class.
-
OBJECT
Constructs an object typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Type Parameters:
O- the object type- Parameters:
type- theClassobject for the type of the Java objects in the fieldname- the name of the field- Returns:
- a field of the appropriate object type with the given name.
-
PARAMETERIZED
public static <O> Field PARAMETERIZED(Class<O> type, String extendedType, Type[] genericParams, String name) Constructs an object typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Type Parameters:
O- the object type- Parameters:
type- theClassobject for the type of the Java objects in the fieldname- the name of the field- Returns:
- a field of the appropriate object type with the given name.
-
FLOAT
Constructs a float typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of float type with the given name.
-
DOUBLE
Constructs a double typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of double type with the given name.
-
PERIOD
Constructs a period typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of period type with the given name.
-
STRING
Constructs a string typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of string type with the given name.
-
STRING
Constructs a string typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the fieldvalues- the domain of the string field- Returns:
- a field of string type with the given name.
-
STRING
Constructs a string typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the fieldvalues- the domain of the string field- Returns:
- a field of string type with the given name.
-
TIME
Constructs a time typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of time type with the given name.
-
TIMESTAMP
Constructs a timestamp typed field with the given name.This method is used in conjunction with
record(Field...)to construct record types.- Parameters:
name- the name of the field- Returns:
- a field of timestamp type with the given name.
-
record
Constructs a record type descriptor with the given fields.This method, in conjunction with the
Fieldfactory 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.
- Parameters:
fields- the fields describing the schema of this record type- Returns:
- a record type descriptor for the given schema
-
domain
Returns a new field object with the same type and name as the original, but with the domain set to the given value.- Parameters:
field- The fielddomain- The value domain- Returns:
- a new field with the domain as specified
-
DOMAIN
Creates a field with the domain set to the given values- Parameters:
field- the field. must be a string fieldvalues- the string values in the domain- Returns:
- a field the domain set to the given values
- Throws:
IllegalArgumentException- if the field is not a string field
-
DOMAIN
Creates a field domain with the domain set to the given values- Parameters:
values- the string values in the domain- Returns:
- a field domain
-
sparseRecord
Constructs a record type descriptor with the given fields.This method, in conjunction with the
Fieldfactory 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.- Parameters:
fields- the fields describing the schema of this record type- Returns:
- a record type descriptor for the given schema
-
values
Gets the descriptors for all supported token types.- Returns:
- descriptors for all types
-
scalars
Gets the descriptors for all supported scalar token types.- Returns:
- descriptors for all scalar types
-
getScalar
Gets the constant scalar token type descriptor for the specified name.- Parameters:
name- the scalar type for which to get the type descriptor- Returns:
- the constant descriptor for the scalar type
-