@NotThreadSafe public static class ImmutableSchemata.Builder extends Object
Schemata
objects.Modifier | Constructor and Description |
---|---|
protected |
Builder(ExecutionContext context,
NodeTypes nodeTypes) |
Modifier and Type | Method and Description |
---|---|
ImmutableSchemata.Builder |
addColumn(String tableName,
String columnName,
String type)
Add a column with the supplied name and type to the named table.
|
ImmutableSchemata.Builder |
addColumn(String tableName,
String columnName,
String type,
PropertyType requiredType,
boolean fullTextSearchable,
boolean orderable,
Object minimum,
Object maximum,
Set<Operator> operations)
Add a column with the supplied name and type to the named table.
|
ImmutableSchemata.Builder |
addKey(String tableName,
String... columnNames)
Add to the specified table a key that references the existing named columns.
|
ImmutableSchemata.Builder |
addTable(String name,
String... columnNames)
Add a table with the supplied name and column names.
|
ImmutableSchemata.Builder |
addTable(String name,
String[] columnNames,
String[] types)
Add a table with the supplied name and column names and types.
|
ImmutableSchemata.Builder |
addView(String name,
QueryCommand definition)
Add a view with the supplied name and definition.
|
ImmutableSchemata.Builder |
addView(String name,
String definition)
Add a view with the supplied name and SQL string definition.
|
Schemata |
build()
Build the
Schemata instance, using the current state of the builder. |
ImmutableSchemata.Builder |
excludeFromSelectStar(String tableName,
String columnName)
Specify that the named column in the given table should be excluded from the selected columns when "SELECT *" is used.
|
ImmutableSchemata.Builder |
makeSearchable(String tableName,
String columnName)
Make sure the column on the named table is searchable.
|
ImmutableSchemata.Builder |
markExtraColumns(String tableName)
Make sure the column on the named table has extra columns that can be used without validation error.
|
ImmutableSchemata.Builder |
markOperators(String tableName,
String columnName,
Set<Operator> operators)
Record the operators that are allowed for the named column on the named table.
|
ImmutableSchemata.Builder |
markOrderable(String tableName,
String columnName,
boolean orderable)
Record whether the column on the named table should be orderable.
|
protected Set<Operator> |
operators(SelectorName tableName,
String columnName,
Set<Operator> defaultOperators) |
protected boolean |
orderable(SelectorName tableName,
String columnName,
boolean defaultValue) |
protected Builder(ExecutionContext context, NodeTypes nodeTypes)
public ImmutableSchemata.Builder addTable(String name, String... columnNames)
name
- the name of the new tablecolumnNames
- the names of the columns.IllegalArgumentException
- if the table name is null or empty, any column name is null or empty, or if no column
names are givenpublic ImmutableSchemata.Builder addTable(String name, String[] columnNames, String[] types)
name
- the name of the new tablecolumnNames
- the names of the columnstypes
- the types for the columnsIllegalArgumentException
- if the table name is null or empty, any column name is null or empty, if no column
names are given, or if the number of types does not match the number of columnspublic ImmutableSchemata.Builder addView(String name, String definition)
name
- the name of the new viewdefinition
- the SQL definition of the viewIllegalArgumentException
- if the view name is null or empty or the definition is nullParsingException
- if the supplied definition is cannot be parsed as a SQL querypublic ImmutableSchemata.Builder addView(String name, QueryCommand definition)
name
- the name of the new viewdefinition
- the definition of the viewIllegalArgumentException
- if the view name is null or empty or the definition is nullpublic ImmutableSchemata.Builder addColumn(String tableName, String columnName, String type)
tableName
- the name of the new tablecolumnName
- the names of the columntype
- the type for the columnIllegalArgumentException
- if the table name is null or empty, any column name is null or empty, if no column
names are given, or if the number of types does not match the number of columnspublic ImmutableSchemata.Builder addColumn(String tableName, String columnName, String type, PropertyType requiredType, boolean fullTextSearchable, boolean orderable, Object minimum, Object maximum, Set<Operator> operations)
tableName
- the name of the new tablecolumnName
- the names of the columntype
- the type for the columnrequiredType
- the requiredType for the column; never nullfullTextSearchable
- true if the column should be full-text searchable, or false if notorderable
- true if the column can be used in order clauses, or false if notminimum
- the minimum value for the column; may be nullmaximum
- the maximum value for the column; may be nulloperations
- the set operations that can be applied to this column within comparisons; may be empty or null if all
operations applyIllegalArgumentException
- if the table name is null or empty, the column name is null or empty, or if the
property type is nullpublic ImmutableSchemata.Builder makeSearchable(String tableName, String columnName)
tableName
- the name of the new tablecolumnName
- the names of the columnIllegalArgumentException
- if the table name is null or empty or if the column name is null or emptypublic ImmutableSchemata.Builder markOrderable(String tableName, String columnName, boolean orderable)
tableName
- the name of the new tablecolumnName
- the names of the columnorderable
- true if the column should be orderable, or false otherwiseprotected boolean orderable(SelectorName tableName, String columnName, boolean defaultValue)
public ImmutableSchemata.Builder markOperators(String tableName, String columnName, Set<Operator> operators)
tableName
- the name of the new tablecolumnName
- the names of the columnoperators
- the set of operators, or null or empty if the default operators should be usedprotected Set<Operator> operators(SelectorName tableName, String columnName, Set<Operator> defaultOperators)
public ImmutableSchemata.Builder markExtraColumns(String tableName)
tableName
- the name of the tableIllegalArgumentException
- if the table name is null or empty, or the table does not existpublic ImmutableSchemata.Builder excludeFromSelectStar(String tableName, String columnName)
tableName
- the name of the new tablecolumnName
- the names of the columnIllegalArgumentException
- if the table name is null or empty or if the column name is null or emptypublic ImmutableSchemata.Builder addKey(String tableName, String... columnNames)
tableName
- the name of the new tablecolumnNames
- the names of the (existing) columns that make up the keyIllegalArgumentException
- if the table name is null or empty, the array of column names is null or empty, or if
the column names do not reference existing columns in the tablepublic Schemata build()
Schemata
instance, using the current state of the builder. This method creates a snapshot of the
tables (with their columns) as they exist at the moment this method is called.InvalidQueryException
- if any of the view definitions is invalid and cannot be resolvedCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.