public static class Schema.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
Schema.Builder |
addColumn(ColumnMetaData metaData)
Add a column
|
Schema.Builder |
addColumnCategorical(java.lang.String name,
java.util.List<java.lang.String> stateNames)
Add a Categorical column, with the specified state names
|
Schema.Builder |
addColumnCategorical(java.lang.String name,
java.lang.String... stateNames)
Add a Categorical column, with the specified state names
|
Schema.Builder |
addColumnDouble(java.lang.String name)
Add a Double column with no restrictions on the allowable values, except for no NaN/infinite values allowed
|
Schema.Builder |
addColumnDouble(java.lang.String name,
java.lang.Double minAllowedValue,
java.lang.Double maxAllowedValue)
Add a Double column with the specified restrictions (and no NaN/Infinite values allowed)
|
Schema.Builder |
addColumnDouble(java.lang.String name,
java.lang.Double minAllowedValue,
java.lang.Double maxAllowedValue,
boolean allowNaN,
boolean allowInfinite)
Add a double column with the specified restrictions
|
Schema.Builder |
addColumnFloat(java.lang.String name)
Add a Double column with no restrictions on the allowable values, except for no NaN/infinite values allowed
|
Schema.Builder |
addColumnInteger(java.lang.String name)
Add an integer column with no restrictions on the allowable values
|
Schema.Builder |
addColumnInteger(java.lang.String name,
java.lang.Integer minAllowedValue,
java.lang.Integer maxAllowedValue)
Add an integer column with the specified min/max allowable values
|
Schema.Builder |
addColumnLong(java.lang.String name)
Add a Long column, with no restrictions on the min/max values
|
Schema.Builder |
addColumnLong(java.lang.String name,
java.lang.Long minAllowedValue,
java.lang.Long maxAllowedValue)
Add an Long column with the specified min/max allowable values
|
Schema.Builder |
addColumnsDouble(java.lang.String... columnNames)
Add multiple columns with no restrictions on the allowable values of the columns (other than no NaN/Infinite)
|
Schema.Builder |
addColumnsDouble(java.lang.String pattern,
int minIdxInclusive,
int maxIdxInclusive)
A convenience method for adding multiple double columns.
|
Schema.Builder |
addColumnsDouble(java.lang.String pattern,
int minIdxInclusive,
int maxIdxInclusive,
java.lang.Double minAllowedValue,
java.lang.Double maxAllowedValue,
boolean allowNaN,
boolean allowInfinite)
A convenience method for adding multiple double columns, with additional restrictions that apply to all columns
For example, to add columns "myDoubleCol_0", "myDoubleCol_1", "myDoubleCol_2", use
addColumnsDouble("myDoubleCol_%d",0,2,null,null,false,false) |
Schema.Builder |
addColumnsInteger(java.lang.String... names)
Add multiple Integer columns with no restrictions on the min/max allowable values
|
Schema.Builder |
addColumnsInteger(java.lang.String pattern,
int minIdxInclusive,
int maxIdxInclusive)
A convenience method for adding multiple Integer columns.
|
Schema.Builder |
addColumnsInteger(java.lang.String pattern,
int minIdxInclusive,
int maxIdxInclusive,
java.lang.Integer minAllowedValue,
java.lang.Integer maxAllowedValue)
A convenience method for adding multiple Integer columns.
|
Schema.Builder |
addColumnsLong(java.lang.String... names)
Add multiple long columns, with no restrictions on the allowable values
|
Schema.Builder |
addColumnsLong(java.lang.String pattern,
int minIdxInclusive,
int maxIdxInclusive)
A convenience method for adding multiple Long columns.
|
Schema.Builder |
addColumnsLong(java.lang.String pattern,
int minIdxInclusive,
int maxIdxInclusive,
java.lang.Long minAllowedValue,
java.lang.Long maxAllowedValue)
A convenience method for adding multiple Long columns.
|
Schema.Builder |
addColumnsString(java.lang.String... columnNames)
Add String columns with no restrictions on the allowable values
|
Schema.Builder |
addColumnsString(java.lang.String pattern,
int minIdxInclusive,
int maxIdxInclusive)
A convenience method for adding multiple numbered String columns.
|
Schema.Builder |
addColumnsString(java.lang.String pattern,
int minIdxInclusive,
int maxIdxInclusive,
java.lang.String regex,
java.lang.Integer minAllowedLength,
java.lang.Integer maxAllowedLength)
A convenience method for adding multiple numbered String columns.
|
Schema.Builder |
addColumnString(java.lang.String name)
Add a String column with no restrictions on the allowable values.
|
Schema.Builder |
addColumnString(java.lang.String name,
java.lang.String regex,
java.lang.Integer minAllowableLength,
java.lang.Integer maxAllowableLength)
Add a String column with the specified restrictions
|
Schema.Builder |
addColumnTime(java.lang.String columnName,
org.joda.time.DateTimeZone timeZone)
Add a Time column with no restrictions on the min/max allowable times
NOTE: Time columns are represented by LONG (epoch millisecond) values.
|
Schema.Builder |
addColumnTime(java.lang.String columnName,
org.joda.time.DateTimeZone timeZone,
java.lang.Long minValidValue,
java.lang.Long maxValidValue)
Add a Time column with the specified restrictions
NOTE: Time columns are represented by LONG (epoch millisecond) values.
|
Schema.Builder |
addColumnTime(java.lang.String columnName,
java.util.TimeZone timeZone)
Add a Time column with no restrictions on the min/max allowable times
NOTE: Time columns are represented by LONG (epoch millisecond) values.
|
Schema |
build()
Create the Schema
|
public Schema.Builder addColumnFloat(java.lang.String name)
name
- Name of the columnpublic Schema.Builder addColumnDouble(java.lang.String name)
name
- Name of the columnpublic Schema.Builder addColumnDouble(java.lang.String name, java.lang.Double minAllowedValue, java.lang.Double maxAllowedValue)
name
- Name of the columnminAllowedValue
- Minimum allowed value (inclusive). If null: no restrictionmaxAllowedValue
- Maximum allowed value (inclusive). If null: no restrictionpublic Schema.Builder addColumnDouble(java.lang.String name, java.lang.Double minAllowedValue, java.lang.Double maxAllowedValue, boolean allowNaN, boolean allowInfinite)
name
- Name of the columnminAllowedValue
- Minimum allowed value (inclusive). If null: no restrictionmaxAllowedValue
- Maximum allowed value (inclusive). If null: no restrictionallowNaN
- If false: don't allow NaN values. If true: allow.allowInfinite
- If false: don't allow infinite values. If true: allowpublic Schema.Builder addColumnsDouble(java.lang.String... columnNames)
columnNames
- Names of the columns to addpublic Schema.Builder addColumnsDouble(java.lang.String pattern, int minIdxInclusive, int maxIdxInclusive)
addColumnsDouble("myDoubleCol_%d",0,2)
pattern
- Pattern to use (via String.format). "%d" is replaced with column numbersminIdxInclusive
- Minimum column index to use (inclusive)maxIdxInclusive
- Maximum column index to use (inclusive)public Schema.Builder addColumnsDouble(java.lang.String pattern, int minIdxInclusive, int maxIdxInclusive, java.lang.Double minAllowedValue, java.lang.Double maxAllowedValue, boolean allowNaN, boolean allowInfinite)
addColumnsDouble("myDoubleCol_%d",0,2,null,null,false,false)
pattern
- Pattern to use (via String.format). "%d" is replaced with column numbersminIdxInclusive
- Minimum column index to use (inclusive)maxIdxInclusive
- Maximum column index to use (inclusive)minAllowedValue
- Minimum allowed value (inclusive). If null: no restrictionmaxAllowedValue
- Maximum allowed value (inclusive). If null: no restrictionallowNaN
- If false: don't allow NaN values. If true: allow.allowInfinite
- If false: don't allow infinite values. If true: allowpublic Schema.Builder addColumnInteger(java.lang.String name)
name
- Name of the columnpublic Schema.Builder addColumnInteger(java.lang.String name, java.lang.Integer minAllowedValue, java.lang.Integer maxAllowedValue)
name
- Name of the columnminAllowedValue
- Minimum allowed value (inclusive). If null: no restrictionmaxAllowedValue
- Maximum allowed value (inclusive). If null: no restrictionpublic Schema.Builder addColumnsInteger(java.lang.String... names)
names
- Names of the integer columns to addpublic Schema.Builder addColumnsInteger(java.lang.String pattern, int minIdxInclusive, int maxIdxInclusive)
addColumnsInteger("myIntegerCol_%d",0,2)
pattern
- Pattern to use (via String.format). "%d" is replaced with column numbersminIdxInclusive
- Minimum column index to use (inclusive)maxIdxInclusive
- Maximum column index to use (inclusive)public Schema.Builder addColumnsInteger(java.lang.String pattern, int minIdxInclusive, int maxIdxInclusive, java.lang.Integer minAllowedValue, java.lang.Integer maxAllowedValue)
addColumnsInteger("myIntegerCol_%d",0,2)
pattern
- Pattern to use (via String.format). "%d" is replaced with column numbersminIdxInclusive
- Minimum column index to use (inclusive)maxIdxInclusive
- Maximum column index to use (inclusive)minAllowedValue
- Minimum allowed value (inclusive). If null: no restrictionmaxAllowedValue
- Maximum allowed value (inclusive). If null: no restrictionpublic Schema.Builder addColumnCategorical(java.lang.String name, java.lang.String... stateNames)
name
- Name of the columnstateNames
- Names of the allowable states for this categorical columnpublic Schema.Builder addColumnCategorical(java.lang.String name, java.util.List<java.lang.String> stateNames)
name
- Name of the columnstateNames
- Names of the allowable states for this categorical columnpublic Schema.Builder addColumnLong(java.lang.String name)
name
- Name of the columnpublic Schema.Builder addColumnLong(java.lang.String name, java.lang.Long minAllowedValue, java.lang.Long maxAllowedValue)
name
- Name of the columnminAllowedValue
- Minimum allowed value (inclusive). If null: no restrictionmaxAllowedValue
- Maximum allowed value (inclusive). If null: no restrictionpublic Schema.Builder addColumnsLong(java.lang.String... names)
names
- Names of the Long columns to addpublic Schema.Builder addColumnsLong(java.lang.String pattern, int minIdxInclusive, int maxIdxInclusive)
addColumnsLong("myLongCol_%d",0,2)
pattern
- Pattern to use (via String.format). "%d" is replaced with column numbersminIdxInclusive
- Minimum column index to use (inclusive)maxIdxInclusive
- Maximum column index to use (inclusive)public Schema.Builder addColumnsLong(java.lang.String pattern, int minIdxInclusive, int maxIdxInclusive, java.lang.Long minAllowedValue, java.lang.Long maxAllowedValue)
addColumnsLong("myLongCol_%d",0,2)
pattern
- Pattern to use (via String.format). "%d" is replaced with column numbersminIdxInclusive
- Minimum column index to use (inclusive)maxIdxInclusive
- Maximum column index to use (inclusive)minAllowedValue
- Minimum allowed value (inclusive). If null: no restrictionmaxAllowedValue
- Maximum allowed value (inclusive). If null: no restrictionpublic Schema.Builder addColumn(ColumnMetaData metaData)
metaData
- metadata for this columnpublic Schema.Builder addColumnString(java.lang.String name)
name
- Name of the columnpublic Schema.Builder addColumnsString(java.lang.String... columnNames)
columnNames
- Names of the String columns to addpublic Schema.Builder addColumnString(java.lang.String name, java.lang.String regex, java.lang.Integer minAllowableLength, java.lang.Integer maxAllowableLength)
name
- Name of the columnregex
- Regex that the String must match in order to be considered valid. If null: no regex restrictionminAllowableLength
- Minimum allowable length for the String to be considered validmaxAllowableLength
- Maximum allowable length for the String to be considered validpublic Schema.Builder addColumnsString(java.lang.String pattern, int minIdxInclusive, int maxIdxInclusive)
addColumnsString("myStringCol_%d",0,2)
pattern
- Pattern to use (via String.format). "%d" is replaced with column numbersminIdxInclusive
- Minimum column index to use (inclusive)maxIdxInclusive
- Maximum column index to use (inclusive)public Schema.Builder addColumnsString(java.lang.String pattern, int minIdxInclusive, int maxIdxInclusive, java.lang.String regex, java.lang.Integer minAllowedLength, java.lang.Integer maxAllowedLength)
addColumnsString("myStringCol_%d",0,2)
pattern
- Pattern to use (via String.format). "%d" is replaced with column numbersminIdxInclusive
- Minimum column index to use (inclusive)maxIdxInclusive
- Maximum column index to use (inclusive)regex
- Regex that the String must match in order to be considered valid. If null: no regex restrictionminAllowedLength
- Minimum allowed length of strings (inclusive). If null: no restrictionmaxAllowedLength
- Maximum allowed length of strings (inclusive). If null: no restrictionpublic Schema.Builder addColumnTime(java.lang.String columnName, java.util.TimeZone timeZone)
columnName
- Name of the columntimeZone
- Time zone of the time columnpublic Schema.Builder addColumnTime(java.lang.String columnName, org.joda.time.DateTimeZone timeZone)
columnName
- Name of the columntimeZone
- Time zone of the time columnpublic Schema.Builder addColumnTime(java.lang.String columnName, org.joda.time.DateTimeZone timeZone, java.lang.Long minValidValue, java.lang.Long maxValidValue)
columnName
- Name of the columntimeZone
- Time zone of the time columnminValidValue
- Minumum allowable time (in milliseconds). May be null.maxValidValue
- Maximum allowable time (in milliseconds). May be null.public Schema build()