public class SchemaBuilder extends Object
TextRecord
instances).Modifier and Type | Class and Description |
---|---|
static class |
SchemaBuilder.SchemaField
An internal class used to transform schemas to/from JSON.
|
static class |
SchemaBuilder.SchemaFieldType
Enumeration of schema field types
|
Modifier and Type | Field and Description |
---|---|
static TextTypes.StringConversion |
NULLABLE_RAW
No trimming, empty string is treated as null.
|
static TextTypes.StringConversion |
NULLABLE_TRIMMED
Trim white space and treat empty strings as null.
|
static TextTypes.StringConversion |
RAW
Raw string conversion, no trimming and empty strings are not null.
|
static TextTypes.StringConversion |
TRIMMED
Trim white space, empty strings passed through.
|
Modifier and Type | Method and Description |
---|---|
static SchemaBuilder.SchemaField |
BINARY(String fieldName)
Create a binary field.
|
static SchemaBuilder.SchemaField |
BOOLEAN(String fieldName)
Create a default boolean field.
|
static SchemaBuilder.SchemaField |
BOOLEAN(String fieldName,
String trueValue,
String falseValue)
Create a boolean field with defined values for true/false.
|
static SchemaBuilder.SchemaField |
BOOLEAN(String fieldName,
String trueValue,
String falseValue,
boolean caseSensitive)
Create a boolean field with defined values for true/false.
|
static SchemaBuilder.SchemaField |
CHAR(String fieldName)
Create a default char field.
|
static SchemaBuilder.SchemaField |
DATE(String fieldName)
Create a date field using ISO defined format.
|
static SchemaBuilder.SchemaField |
DATE(String fieldName,
String format)
Create a date field using the defined format or pattern.
|
static TextConversionDefaults |
defaults(String nullIndicator)
Create default settings for a schema.
|
static TextConversionDefaults |
defaults(String nullIndicator,
TextTypes.StringConversion behavior)
Create default settings for a schema.
|
static TextConversionDefaults |
defaults(TextTypes.StringConversion behavior)
Create default settings for a schema.
|
static TextRecord |
define(SchemaBuilder.SchemaField... fields)
Define (create) a new schema object.
|
static TextRecord |
define(String nullIndicator,
SchemaBuilder.SchemaField... fields)
Define (create) a new schema object.
|
static TextRecord |
define(TextConversionDefaults defaults,
SchemaBuilder.SchemaField... fields)
Define (create) a new schema object.
|
static TextRecord |
define(TextTypes.StringConversion conversion,
SchemaBuilder.SchemaField... fields)
Define (create) a new schema object.
|
static SchemaBuilder.SchemaField |
DOUBLE(String fieldName)
Create a double field.
|
static SchemaBuilder.SchemaField |
DOUBLE(String fieldName,
String format)
Create a double field using the defined format or pattern.
|
static SchemaBuilder.SchemaField |
DURATION(String fieldName)
Create a duration field.
|
static SchemaBuilder.SchemaField |
DURATION(String fieldName,
String format)
Create a duration field using the defined format or pattern.
|
static SchemaBuilder.SchemaField |
FLOAT(String fieldName)
Create a float field.
|
static SchemaBuilder.SchemaField |
FLOAT(String fieldName,
String format)
Create a float field using the defined format or pattern.
|
static SchemaBuilder |
fromJSON(String jsonText)
Create a schema builder from it's JSON representation.
|
static SchemaBuilder.SchemaField |
INT(String fieldName)
Create an integer field.
|
static SchemaBuilder.SchemaField |
INT(String fieldName,
String format)
Create an integer field using the defined format or pattern.
|
static SchemaBuilder.SchemaField |
IP4ADDRESS(String fieldName)
Create an ip4address field.
|
static SchemaBuilder.SchemaField |
IP6ADDRESS(String fieldName)
Create an ip6address field.
|
static SchemaBuilder.SchemaField |
LONG(String fieldName)
Create a long field.
|
static SchemaBuilder.SchemaField |
LONG(String fieldName,
String format)
Create a long field using the defined format or pattern.
|
static SchemaBuilder.SchemaField |
MONEY(String fieldName)
Create a money field.
|
static SchemaBuilder.SchemaField |
MONEY(String fieldName,
String format)
Create a money field using the defined format or pattern.
|
static SchemaBuilder |
newInstance(SchemaBuilder.SchemaField... fields)
Create a new schema builder reference.
|
static SchemaBuilder |
newInstance(String nullIndicator,
SchemaBuilder.SchemaField... fields)
Create a new schema builder reference.
|
static SchemaBuilder |
newInstance(TextConversionDefaults defaults,
SchemaBuilder.SchemaField... fields)
Create a new schema builder reference.
|
static SchemaBuilder |
newInstance(TextTypes.StringConversion conversion,
SchemaBuilder.SchemaField... fields)
Create a new schema builder reference.
|
static SchemaBuilder.SchemaField |
NUMERIC(String fieldName)
Create a numeric field.
|
static SchemaBuilder.SchemaField |
NUMERIC(String fieldName,
String format)
Create a numeric field using the defined format or pattern.
|
static SchemaBuilder.SchemaField |
OBJECT(String fieldName)
Create an object field.
|
static SchemaBuilder.SchemaField |
PERIOD(String fieldName)
Create a period field.
|
static SchemaBuilder.SchemaField |
PERIOD(String fieldName,
String format)
Create a period field using the defined format or pattern.
|
static SchemaBuilder.SchemaField |
STRING(String fieldName)
Create a string field.
|
static SchemaBuilder.SchemaField |
STRING(String fieldName,
List<String> domain)
Create a string field.
|
static SchemaBuilder.SchemaField |
STRING(String fieldName,
String... domain)
Create a string field.
|
static SchemaBuilder.SchemaField |
TIMEOFDAY(String fieldName)
Create a timeofday field using ISO defined format.
|
static SchemaBuilder.SchemaField |
TIMEOFDAY(String fieldName,
String format)
Create a timeofday field using the defined format or pattern.
|
static SchemaBuilder.SchemaField |
TIMESTAMP(String fieldName)
Create a timestamp field using ISO defined format.
|
static SchemaBuilder.SchemaField |
TIMESTAMP(String fieldName,
String format)
Create a timestamp field using the defined format or pattern.
|
String |
toJSON()
Convert the defined schema into JSON format for serialization purposes.
|
TextRecord |
toTextRecord()
Convert the defined schema into a
TextRecord that is usable
by text readers. |
public static TextTypes.StringConversion RAW
public static TextTypes.StringConversion NULLABLE_RAW
public static TextTypes.StringConversion TRIMMED
public static TextTypes.StringConversion NULLABLE_TRIMMED
public static SchemaBuilder.SchemaField BOOLEAN(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField BOOLEAN(String fieldName, String trueValue, String falseValue)
fieldName
- name of the fieldtrueValue
- value representing truefalseValue
- value representing falsepublic static SchemaBuilder.SchemaField BOOLEAN(String fieldName, String trueValue, String falseValue, boolean caseSensitive)
fieldName
- name of the fieldtrueValue
- value representing truefalseValue
- value representing falsecaseSensitive
- if true, values are case sensitive; case insensitive otherwisepublic static SchemaBuilder.SchemaField BINARY(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField CHAR(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField DATE(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField DATE(String fieldName, String format)
DateFormat
.fieldName
- name of the fieldformat
- format patternpublic static SchemaBuilder.SchemaField DOUBLE(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField DOUBLE(String fieldName, String format)
DecimalFormat
.fieldName
- name of the fieldformat
- format patternpublic static SchemaBuilder.SchemaField DURATION(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField DURATION(String fieldName, String format)
IntervalFormatting
.fieldName
- name of the fieldformat
- format patternpublic static SchemaBuilder.SchemaField FLOAT(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField FLOAT(String fieldName, String format)
DecimalFormat
.fieldName
- name of the fieldformat
- format patternpublic static SchemaBuilder.SchemaField INT(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField INT(String fieldName, String format)
DecimalFormat
.fieldName
- name of the fieldformat
- format patternpublic static SchemaBuilder.SchemaField IP4ADDRESS(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField IP6ADDRESS(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField LONG(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField LONG(String fieldName, String format)
DecimalFormat
.fieldName
- name of the fieldformat
- format patternpublic static SchemaBuilder.SchemaField MONEY(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField MONEY(String fieldName, String format)
DecimalFormat
.fieldName
- name of the fieldformat
- format patternpublic static SchemaBuilder.SchemaField NUMERIC(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField NUMERIC(String fieldName, String format)
DecimalFormat
.fieldName
- name of the fieldformat
- format patternpublic static SchemaBuilder.SchemaField PERIOD(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField PERIOD(String fieldName, String format)
IntervalFormatting
.fieldName
- name of the fieldformat
- format patternpublic static SchemaBuilder.SchemaField STRING(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField OBJECT(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField STRING(String fieldName, String... domain)
fieldName
- name of the fielddomain
- the domain of the fieldpublic static SchemaBuilder.SchemaField STRING(String fieldName, List<String> domain)
fieldName
- name of the fielddomain
- the domain of the fieldpublic static SchemaBuilder.SchemaField TIMEOFDAY(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField TIMEOFDAY(String fieldName, String format)
DateFormat
fieldName
- name of the fieldformat
- format patternpublic static SchemaBuilder.SchemaField TIMESTAMP(String fieldName)
fieldName
- name of the fieldpublic static SchemaBuilder.SchemaField TIMESTAMP(String fieldName, String format)
DateFormat
.fieldName
- name of the fieldformat
- format patternpublic static TextRecord define(String nullIndicator, SchemaBuilder.SchemaField... fields)
nullIndicator
- string representing a value is not available (null)fields
- field definitions to add to the schema (order is important)public static TextRecord define(TextTypes.StringConversion conversion, SchemaBuilder.SchemaField... fields)
conversion
- enumeration defining how to convert fields of type stringfields
- field definitions to add to the schema (order is important)public static TextRecord define(TextConversionDefaults defaults, SchemaBuilder.SchemaField... fields)
defaults
- default schema settings for the null indicator and the string conversion settingfields
- field definitions to add to the schema (order is important)public static TextRecord define(SchemaBuilder.SchemaField... fields)
fields
- field definitions to add to the schema (order is important)public static SchemaBuilder newInstance(String nullIndicator, SchemaBuilder.SchemaField... fields)
nullIndicator
- string representing a value is not available (null)fields
- field definitions to add to the schema (order is important)public static SchemaBuilder newInstance(TextTypes.StringConversion conversion, SchemaBuilder.SchemaField... fields)
conversion
- enumeration defining how to convert fields of type stringfields
- field definitions to add to the schema (order is important)public static SchemaBuilder newInstance(TextConversionDefaults defaults, SchemaBuilder.SchemaField... fields)
defaults
- default schema settings for the null indicator and the string conversion settingfields
- field definitions to add to the schema (order is important)public static SchemaBuilder newInstance(SchemaBuilder.SchemaField... fields)
fields
- field definitions to add to the schema (order is important)public static SchemaBuilder fromJSON(String jsonText)
jsonText
- text containing the JSON representation of a schema builderIllegalArgumentException
- thrown if the given text cannot be parsed by the JSON parserpublic static TextConversionDefaults defaults(String nullIndicator)
nullIndicator
- string representing a value is not available (null)public static TextConversionDefaults defaults(TextTypes.StringConversion behavior)
behavior
- enumeration defining how to convert fields of type stringpublic static TextConversionDefaults defaults(String nullIndicator, TextTypes.StringConversion behavior)
nullIndicator
- string representing a value is not available (null)behavior
- enumeration defining how to convert fields of type stringpublic TextRecord toTextRecord()
TextRecord
that is usable
by text readers.public String toJSON()
Copyright © 2020 Actian Corporation. All rights reserved.