- java.lang.Object
-
- com.pervasive.datarush.types.RecordTokenTypeBuilder
-
public class RecordTokenTypeBuilder extends Object
An object for dynamically constructing a record type. Construction of a record type consists of defining its schema. Specifically, theField
objects comprising the schema must be collected. The order in which they are added is preserved, as it can be important (seeRecordTokenType
for more).When a record type is unknown until composition or execution time, this class is the preferred method for creating a descriptor for the type. For record types that can be statically defined, the factory methods in
TokenTypeConstant
are recommended instead.
-
-
Constructor Summary
Constructors Constructor Description RecordTokenTypeBuilder()
Constructs a new record schema builder.RecordTokenTypeBuilder(DataRepresentation representation)
Constructs a new record schema builder where the specified representation format is used.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addField(Field field)
Adds the specified field to this collection.void
addField(String name, Field field)
Adds a new field with the same type, domain, and properties as the original field but with a new namevoid
addField(String name, ScalarTokenType type)
Adds a field with the specified name and type to this collection.void
addField(String name, ScalarTokenType type, FieldDomain domain)
Adds a field with the specified name and type to this collection.void
addField(String name, ScalarTokenType type, Map<String,String> properties, FieldDomain domain, boolean primaryKey)
Adds a field with the specified name and type to this collection.RecordTokenType
toType()
Gets the record schema currently defined by this collection.
-
-
-
Constructor Detail
-
RecordTokenTypeBuilder
public RecordTokenTypeBuilder()
Constructs a new record schema builder. The initial schema contains noField
entries.
-
RecordTokenTypeBuilder
public RecordTokenTypeBuilder(DataRepresentation representation)
Constructs a new record schema builder where the specified representation format is used. The initial schema contains noField
entries.- Parameters:
representation
- the format to use in the type being built
-
-
Method Detail
-
addField
public void addField(String name, ScalarTokenType type)
Adds a field with the specified name and type to this collection.- Parameters:
name
- a name uniquely identifying the field within this collectiontype
- the data type of the field
-
addField
public void addField(String name, Field field)
Adds a new field with the same type, domain, and properties as the original field but with a new name- Parameters:
name
- the new namefield
- the field
-
addField
public void addField(String name, ScalarTokenType type, FieldDomain domain)
Adds a field with the specified name and type to this collection.- Parameters:
name
- a name uniquely identifying the field within this collectiontype
- the data type of the fielddomain
- the domain of the field
-
addField
public void addField(String name, ScalarTokenType type, Map<String,String> properties, FieldDomain domain, boolean primaryKey)
Adds a field with the specified name and type to this collection.- Parameters:
name
- a name uniquely identifying the field within this collectiontype
- the data type of the fieldproperties
- properties associated with this fielddomain
- the domain of the fieldprimaryKey
- whether the values of the field must be unique
-
addField
public void addField(Field field)
Adds the specified field to this collection.- Parameters:
field
- the field to add to the schema. The field name must differ from that of any existing field in the schema.
-
toType
public RecordTokenType toType()
Gets the record schema currently defined by this collection.- Returns:
- an immutable copy of the schema
-
-