Class SchemaBuilder

java.lang.Object
com.pervasive.datarush.schema.SchemaBuilder

public class SchemaBuilder extends Object
Collection of static methods helpful in building schemas (TextRecord instances).
  • Field Details

  • Method Details

    • BOOLEAN

      public static SchemaBuilder.SchemaField BOOLEAN(String fieldName)
      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 field
      trueValue - value representing true
      falseValue - 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 field
      trueValue - value representing true
      falseValue - value representing false
      caseSensitive - if true, values are case sensitive; case insensitive otherwise
      Returns:
      boolean field
    • BINARY

      public static SchemaBuilder.SchemaField BINARY(String fieldName)
      Create a binary field.
      Parameters:
      fieldName - name of the field
      Returns:
      binary field
    • CHAR

      public static SchemaBuilder.SchemaField CHAR(String fieldName)
      Create a default char field.
      Parameters:
      fieldName - name of the field
      Returns:
      char field
    • DATE

      public static SchemaBuilder.SchemaField DATE(String fieldName)
      Create a date field using ISO defined format.
      Parameters:
      fieldName - name of the field
      Returns:
      date field
    • DATE

      public static SchemaBuilder.SchemaField DATE(String fieldName, String format)
      Create a date field using the defined format or pattern. The pattern syntax is defined in DateFormat.
      Parameters:
      fieldName - name of the field
      format - format pattern
      Returns:
      date field
    • DOUBLE

      public static SchemaBuilder.SchemaField DOUBLE(String fieldName)
      Create a double field.
      Parameters:
      fieldName - name of the field
      Returns:
      double field
    • DOUBLE

      public static SchemaBuilder.SchemaField DOUBLE(String fieldName, String format)
      Create a double field using the defined format or pattern. The pattern syntax is defined in DecimalFormat.
      Parameters:
      fieldName - name of the field
      format - format pattern
      Returns:
      double field
    • DURATION

      public static SchemaBuilder.SchemaField DURATION(String fieldName)
      Create a duration field.
      Parameters:
      fieldName - name of the field
      Returns:
      duration field
    • DURATION

      public static SchemaBuilder.SchemaField DURATION(String fieldName, String format)
      Create a duration field using the defined format or pattern. The pattern syntax is defined in IntervalFormatting.
      Parameters:
      fieldName - name of the field
      format - format pattern
      Returns:
      duration field
    • FLOAT

      public static SchemaBuilder.SchemaField FLOAT(String fieldName)
      Create a float field.
      Parameters:
      fieldName - name of the field
      Returns:
      float field
    • FLOAT

      public static SchemaBuilder.SchemaField FLOAT(String fieldName, String format)
      Create a float field using the defined format or pattern. The pattern syntax is defined in DecimalFormat.
      Parameters:
      fieldName - name of the field
      format - format pattern
      Returns:
      float field
    • INT

      public static SchemaBuilder.SchemaField INT(String fieldName)
      Create an integer field.
      Parameters:
      fieldName - name of the field
      Returns:
      integer field
    • INT

      public static SchemaBuilder.SchemaField INT(String fieldName, String format)
      Create an integer field using the defined format or pattern. The pattern syntax is defined in DecimalFormat.
      Parameters:
      fieldName - name of the field
      format - format pattern
      Returns:
      integer field
    • IP4ADDRESS

      public static SchemaBuilder.SchemaField IP4ADDRESS(String fieldName)
      Create an ip4address field.
      Parameters:
      fieldName - name of the field
      Returns:
      ip4address field
    • IP6ADDRESS

      public static SchemaBuilder.SchemaField IP6ADDRESS(String fieldName)
      Create an ip6address field.
      Parameters:
      fieldName - name of the field
      Returns:
      ip6address field
    • LONG

      public static SchemaBuilder.SchemaField LONG(String fieldName)
      Create a long field.
      Parameters:
      fieldName - name of the field
      Returns:
      long field
    • LONG

      public static SchemaBuilder.SchemaField LONG(String fieldName, String format)
      Create a long field using the defined format or pattern. The pattern syntax is defined in DecimalFormat.
      Parameters:
      fieldName - name of the field
      format - format pattern
      Returns:
      long field
    • MONEY

      public static SchemaBuilder.SchemaField MONEY(String fieldName)
      Create a money field.
      Parameters:
      fieldName - name of the field
      Returns:
      money field
    • MONEY

      public static SchemaBuilder.SchemaField MONEY(String fieldName, String format)
      Create a money field using the defined format or pattern. The pattern syntax is defined in DecimalFormat.
      Parameters:
      fieldName - name of the field
      format - format pattern
      Returns:
      money field
    • NUMERIC

      public static SchemaBuilder.SchemaField NUMERIC(String fieldName)
      Create a numeric field.
      Parameters:
      fieldName - name of the field
      Returns:
      numeric field
    • NUMERIC

      public static SchemaBuilder.SchemaField NUMERIC(String fieldName, String format)
      Create a numeric field using the defined format or pattern. The pattern syntax is defined in DecimalFormat.
      Parameters:
      fieldName - name of the field
      format - format pattern
      Returns:
      numeric field
    • PERIOD

      public static SchemaBuilder.SchemaField PERIOD(String fieldName)
      Create a period field.
      Parameters:
      fieldName - name of the field
      Returns:
      period field
    • PERIOD

      public static SchemaBuilder.SchemaField PERIOD(String fieldName, String format)
      Create a period field using the defined format or pattern. The pattern syntax is defined in IntervalFormatting.
      Parameters:
      fieldName - name of the field
      format - format pattern
      Returns:
      period field
    • STRING

      public static SchemaBuilder.SchemaField STRING(String fieldName)
      Create a string field.
      Parameters:
      fieldName - name of the field
      Returns:
      string field
    • OBJECT

      public static SchemaBuilder.SchemaField OBJECT(String fieldName)
      Create an object field.
      Parameters:
      fieldName - name of the field
      Returns:
      object field
    • STRING

      public static SchemaBuilder.SchemaField STRING(String fieldName, String... domain)
      Create a string field.
      Parameters:
      fieldName - name of the field
      domain - the domain of the field
      Returns:
      string field
    • STRING

      public static SchemaBuilder.SchemaField STRING(String fieldName, List<String> domain)
      Create a string field.
      Parameters:
      fieldName - name of the field
      domain - the domain of the field
      Returns:
      string field
    • TIMEOFDAY

      public static SchemaBuilder.SchemaField TIMEOFDAY(String fieldName)
      Create a timeofday field using ISO defined format.
      Parameters:
      fieldName - name of the field
      Returns:
      timeofday field
    • TIMEOFDAY

      public static SchemaBuilder.SchemaField TIMEOFDAY(String fieldName, String format)
      Create a timeofday field using the defined format or pattern. The pattern syntax is defined in DateFormat
      Parameters:
      fieldName - name of the field
      format - format pattern
      Returns:
      timeofday field
    • TIMESTAMP

      public static SchemaBuilder.SchemaField TIMESTAMP(String fieldName)
      Create a timestamp field using ISO defined format.
      Parameters:
      fieldName - name of the field
      Returns:
      timestamp field
    • TIMESTAMP

      public static SchemaBuilder.SchemaField TIMESTAMP(String fieldName, String format)
      Create a timestamp field using the defined format or pattern. The pattern syntax is defined in DateFormat.
      Parameters:
      fieldName - name of the field
      format - format pattern
      Returns:
      timestamp field
    • define

      public static TextRecord define(String nullIndicator, SchemaBuilder.SchemaField... fields)
      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 string
      fields - 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 setting
      fields - field definitions to add to the schema (order is important)
      Returns:
      new schema object
    • define

      public static TextRecord define(SchemaBuilder.SchemaField... fields)
      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

      public static SchemaBuilder newInstance(String nullIndicator, SchemaBuilder.SchemaField... fields)
      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 string
      fields - 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 setting
      fields - field definitions to add to the schema (order is important)
      Returns:
      new schema builder object
    • newInstance

      public static SchemaBuilder newInstance(SchemaBuilder.SchemaField... fields)
      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

      public static SchemaBuilder fromJSON(String jsonText)
      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

      public static TextConversionDefaults defaults(String nullIndicator)
      Create default settings for a schema.
      Parameters:
      nullIndicator - string representing a value is not available (null)
      Returns:
      conversion defaults
    • defaults

      public static TextConversionDefaults defaults(TextTypes.StringConversion behavior)
      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

      public TextRecord toTextRecord()
      Convert the defined schema into a TextRecord that is usable by text readers.
      Returns:
      the generated text record
    • toJSON

      public String toJSON()
      Convert the defined schema into JSON format for serialization purposes.
      Returns:
      a string containing the schema in JSON format