public class RecordTokenTypeBuilder extends Object
Field
objects comprising the schema must be collected.
The order in which they are added is preserved, as it can
be important (see RecordTokenType
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 and Description |
---|
RecordTokenTypeBuilder()
Constructs a new record schema builder.
|
RecordTokenTypeBuilder(DataRepresentation representation)
Constructs a new record schema builder where the specified
representation format is used.
|
Modifier and Type | Method and 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 name
|
void |
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.
|
public RecordTokenTypeBuilder()
Field
entries.public RecordTokenTypeBuilder(DataRepresentation representation)
Field
entries.representation
- the format to use in the type being builtpublic void addField(String name, ScalarTokenType type)
name
- a name uniquely identifying the field
within this collectiontype
- the data type of the fieldpublic void addField(String name, Field field)
name
- the new namefield
- the fieldpublic void addField(String name, ScalarTokenType type, FieldDomain domain)
name
- a name uniquely identifying the field
within this collectiontype
- the data type of the fielddomain
- the domain of the fieldpublic void addField(String name, ScalarTokenType type, Map<String,String> properties, FieldDomain domain, boolean primaryKey)
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 uniquepublic void addField(Field field)
field
- the field to add to the schema. The
field name must differ from that of any existing
field in the schema.public RecordTokenType toType()
Copyright © 2020 Actian Corporation. All rights reserved.