java.lang.Object
com.pervasive.datarush.schema.SchemaBuilder
Collection of static methods helpful in building schemas (
TextRecord instances).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn internal class used to transform schemas to/from JSON.static enumEnumeration of schema field types -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic TextTypes.StringConversionNo trimming, empty string is treated as null.static TextTypes.StringConversionTrim white space and treat empty strings as null.static TextTypes.StringConversionRaw string conversion, no trimming and empty strings are not null.static TextTypes.StringConversionTrim white space, empty strings passed through. -
Method Summary
Modifier and TypeMethodDescriptionstatic SchemaBuilder.SchemaFieldCreate a binary field.static SchemaBuilder.SchemaFieldCreate a default boolean field.static SchemaBuilder.SchemaFieldCreate a boolean field with defined values for true/false.static SchemaBuilder.SchemaFieldCreate a boolean field with defined values for true/false.static SchemaBuilder.SchemaFieldCreate a default char field.static SchemaBuilder.SchemaFieldCreate a date field using ISO defined format.static SchemaBuilder.SchemaFieldCreate a date field using the defined format or pattern.static TextConversionDefaultsdefaults(TextTypes.StringConversion behavior) Create default settings for a schema.static TextConversionDefaultsCreate default settings for a schema.static TextConversionDefaultsdefaults(String nullIndicator, TextTypes.StringConversion behavior) Create default settings for a schema.static TextRecorddefine(SchemaBuilder.SchemaField... fields) Define (create) a new schema object.static TextRecorddefine(TextConversionDefaults defaults, SchemaBuilder.SchemaField... fields) Define (create) a new schema object.static TextRecorddefine(TextTypes.StringConversion conversion, SchemaBuilder.SchemaField... fields) Define (create) a new schema object.static TextRecorddefine(String nullIndicator, SchemaBuilder.SchemaField... fields) Define (create) a new schema object.static SchemaBuilder.SchemaFieldCreate a double field.static SchemaBuilder.SchemaFieldCreate a double field using the defined format or pattern.static SchemaBuilder.SchemaFieldCreate a duration field.static SchemaBuilder.SchemaFieldCreate a duration field using the defined format or pattern.static SchemaBuilder.SchemaFieldCreate a float field.static SchemaBuilder.SchemaFieldCreate a float field using the defined format or pattern.static SchemaBuilderCreate a schema builder from it's JSON representation.static SchemaBuilder.SchemaFieldCreate an integer field.static SchemaBuilder.SchemaFieldCreate an integer field using the defined format or pattern.static SchemaBuilder.SchemaFieldIP4ADDRESS(String fieldName) Create an ip4address field.static SchemaBuilder.SchemaFieldIP6ADDRESS(String fieldName) Create an ip6address field.static SchemaBuilder.SchemaFieldCreate a long field.static SchemaBuilder.SchemaFieldCreate a long field using the defined format or pattern.static SchemaBuilder.SchemaFieldCreate a money field.static SchemaBuilder.SchemaFieldCreate a money field using the defined format or pattern.static SchemaBuildernewInstance(SchemaBuilder.SchemaField... fields) Create a new schema builder reference.static SchemaBuildernewInstance(TextConversionDefaults defaults, SchemaBuilder.SchemaField... fields) Create a new schema builder reference.static SchemaBuildernewInstance(TextTypes.StringConversion conversion, SchemaBuilder.SchemaField... fields) Create a new schema builder reference.static SchemaBuildernewInstance(String nullIndicator, SchemaBuilder.SchemaField... fields) Create a new schema builder reference.static SchemaBuilder.SchemaFieldCreate a numeric field.static SchemaBuilder.SchemaFieldCreate a numeric field using the defined format or pattern.static SchemaBuilder.SchemaFieldCreate an object field.static SchemaBuilder.SchemaFieldCreate a period field.static SchemaBuilder.SchemaFieldCreate a period field using the defined format or pattern.static SchemaBuilder.SchemaFieldCreate a string field.static SchemaBuilder.SchemaFieldCreate a string field.static SchemaBuilder.SchemaFieldCreate a string field.static SchemaBuilder.SchemaFieldCreate a timeofday field using ISO defined format.static SchemaBuilder.SchemaFieldCreate a timeofday field using the defined format or pattern.static SchemaBuilder.SchemaFieldCreate a timestamp field using ISO defined format.static SchemaBuilder.SchemaFieldCreate a timestamp field using the defined format or pattern.toJSON()Convert the defined schema into JSON format for serialization purposes.Convert the defined schema into aTextRecordthat is usable by text readers.
-
Field Details
-
RAW
Raw string conversion, no trimming and empty strings are not null. -
NULLABLE_RAW
No trimming, empty string is treated as null. -
TRIMMED
Trim white space, empty strings passed through. -
NULLABLE_TRIMMED
Trim white space and treat empty strings as null.
-
-
Method Details
-
BOOLEAN
Create a default boolean field.- Parameters:
fieldName- name of the field- Returns:
- boolean field
-
BOOLEAN
public static SchemaBuilder.SchemaField BOOLEAN(String fieldName, String trueValue, String falseValue) Create a boolean field with defined values for true/false.- Parameters:
fieldName- name of the fieldtrueValue- value representing truefalseValue- value representing false- Returns:
- boolean field
-
BOOLEAN
public static SchemaBuilder.SchemaField BOOLEAN(String fieldName, String trueValue, String falseValue, boolean caseSensitive) Create a boolean field with defined values for true/false.- Parameters:
fieldName- name of the fieldtrueValue- value representing truefalseValue- value representing falsecaseSensitive- if true, values are case sensitive; case insensitive otherwise- Returns:
- boolean field
-
BINARY
Create a binary field.- Parameters:
fieldName- name of the field- Returns:
- binary field
-
CHAR
Create a default char field.- Parameters:
fieldName- name of the field- Returns:
- char field
-
DATE
Create a date field using ISO defined format.- Parameters:
fieldName- name of the field- Returns:
- date field
-
DATE
Create a date field using the defined format or pattern. The pattern syntax is defined inDateFormat.- Parameters:
fieldName- name of the fieldformat- format pattern- Returns:
- date field
-
DOUBLE
Create a double field.- Parameters:
fieldName- name of the field- Returns:
- double field
-
DOUBLE
Create a double field using the defined format or pattern. The pattern syntax is defined inDecimalFormat.- Parameters:
fieldName- name of the fieldformat- format pattern- Returns:
- double field
-
DURATION
Create a duration field.- Parameters:
fieldName- name of the field- Returns:
- duration field
-
DURATION
Create a duration field using the defined format or pattern. The pattern syntax is defined inIntervalFormatting.- Parameters:
fieldName- name of the fieldformat- format pattern- Returns:
- duration field
-
FLOAT
Create a float field.- Parameters:
fieldName- name of the field- Returns:
- float field
-
FLOAT
Create a float field using the defined format or pattern. The pattern syntax is defined inDecimalFormat.- Parameters:
fieldName- name of the fieldformat- format pattern- Returns:
- float field
-
INT
Create an integer field.- Parameters:
fieldName- name of the field- Returns:
- integer field
-
INT
Create an integer field using the defined format or pattern. The pattern syntax is defined inDecimalFormat.- Parameters:
fieldName- name of the fieldformat- format pattern- Returns:
- integer field
-
IP4ADDRESS
Create an ip4address field.- Parameters:
fieldName- name of the field- Returns:
- ip4address field
-
IP6ADDRESS
Create an ip6address field.- Parameters:
fieldName- name of the field- Returns:
- ip6address field
-
LONG
Create a long field.- Parameters:
fieldName- name of the field- Returns:
- long field
-
LONG
Create a long field using the defined format or pattern. The pattern syntax is defined inDecimalFormat.- Parameters:
fieldName- name of the fieldformat- format pattern- Returns:
- long field
-
MONEY
Create a money field.- Parameters:
fieldName- name of the field- Returns:
- money field
-
MONEY
Create a money field using the defined format or pattern. The pattern syntax is defined inDecimalFormat.- Parameters:
fieldName- name of the fieldformat- format pattern- Returns:
- money field
-
NUMERIC
Create a numeric field.- Parameters:
fieldName- name of the field- Returns:
- numeric field
-
NUMERIC
Create a numeric field using the defined format or pattern. The pattern syntax is defined inDecimalFormat.- Parameters:
fieldName- name of the fieldformat- format pattern- Returns:
- numeric field
-
PERIOD
Create a period field.- Parameters:
fieldName- name of the field- Returns:
- period field
-
PERIOD
Create a period field using the defined format or pattern. The pattern syntax is defined inIntervalFormatting.- Parameters:
fieldName- name of the fieldformat- format pattern- Returns:
- period field
-
STRING
Create a string field.- Parameters:
fieldName- name of the field- Returns:
- string field
-
OBJECT
Create an object field.- Parameters:
fieldName- name of the field- Returns:
- object field
-
STRING
Create a string field.- Parameters:
fieldName- name of the fielddomain- the domain of the field- Returns:
- string field
-
STRING
Create a string field.- Parameters:
fieldName- name of the fielddomain- the domain of the field- Returns:
- string field
-
TIMEOFDAY
Create a timeofday field using ISO defined format.- Parameters:
fieldName- name of the field- Returns:
- timeofday field
-
TIMEOFDAY
Create a timeofday field using the defined format or pattern. The pattern syntax is defined inDateFormat- Parameters:
fieldName- name of the fieldformat- format pattern- Returns:
- timeofday field
-
TIMESTAMP
Create a timestamp field using ISO defined format.- Parameters:
fieldName- name of the field- Returns:
- timestamp field
-
TIMESTAMP
Create a timestamp field using the defined format or pattern. The pattern syntax is defined inDateFormat.- Parameters:
fieldName- name of the fieldformat- format pattern- Returns:
- timestamp field
-
define
Define (create) a new schema object.- Parameters:
nullIndicator- string representing a value is not available (null)fields- field definitions to add to the schema (order is important)- Returns:
- new schema object
-
define
public static TextRecord define(TextTypes.StringConversion conversion, SchemaBuilder.SchemaField... fields) Define (create) a new schema object.- Parameters:
conversion- enumeration defining how to convert fields of type stringfields- field definitions to add to the schema (order is important)- Returns:
- new schema object
-
define
public static TextRecord define(TextConversionDefaults defaults, SchemaBuilder.SchemaField... fields) Define (create) a new schema object.- Parameters:
defaults- default schema settings for the null indicator and the string conversion settingfields- field definitions to add to the schema (order is important)- Returns:
- new schema object
-
define
Define (create) a new schema object. Use default values for the default schema settings.- Parameters:
fields- field definitions to add to the schema (order is important)- Returns:
- new schema object
-
newInstance
Create a new schema builder reference.- Parameters:
nullIndicator- string representing a value is not available (null)fields- field definitions to add to the schema (order is important)- Returns:
- new schema builder object
-
newInstance
public static SchemaBuilder newInstance(TextTypes.StringConversion conversion, SchemaBuilder.SchemaField... fields) Create a new schema builder reference.- Parameters:
conversion- enumeration defining how to convert fields of type stringfields- field definitions to add to the schema (order is important)- Returns:
- new schema builder object
-
newInstance
public static SchemaBuilder newInstance(TextConversionDefaults defaults, SchemaBuilder.SchemaField... fields) Create a new schema builder reference.- Parameters:
defaults- default schema settings for the null indicator and the string conversion settingfields- field definitions to add to the schema (order is important)- Returns:
- new schema builder object
-
newInstance
Create a new schema builder reference. Use default values for the default schema settings.- Parameters:
fields- field definitions to add to the schema (order is important)- Returns:
- new schema builder object
-
fromJSON
Create a schema builder from it's JSON representation.- Parameters:
jsonText- text containing the JSON representation of a schema builder- Returns:
- new schema builder reference
- Throws:
IllegalArgumentException- thrown if the given text cannot be parsed by the JSON parser
-
defaults
Create default settings for a schema.- Parameters:
nullIndicator- string representing a value is not available (null)- Returns:
- conversion defaults
-
defaults
Create default settings for a schema.- Parameters:
behavior- enumeration defining how to convert fields of type string- Returns:
- conversion defaults
-
defaults
public static TextConversionDefaults defaults(String nullIndicator, TextTypes.StringConversion behavior) Create default settings for a schema.- Parameters:
nullIndicator- string representing a value is not available (null)behavior- enumeration defining how to convert fields of type string- Returns:
- conversion defaults
-
toTextRecord
Convert the defined schema into aTextRecordthat is usable by text readers.- Returns:
- the generated text record
-
toJSON
Convert the defined schema into JSON format for serialization purposes.- Returns:
- a string containing the schema in JSON format
-