Package com.tableau.hyperapi
Class TableDefinition
java.lang.Object
com.tableau.hyperapi.TableDefinition
The schema of a table.
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionTableDefinition
(TableName tableName) Creates a new, emptyTableDefinition
of permanent persistence.TableDefinition
(TableName tableName, Persistence persistence) Creates a new, emptyTableDefinition
with the given persistence.TableDefinition
(TableName tableName, List<TableDefinition.Column> columns) Creates a newTableDefinition
of permanent persistence with the given columns.TableDefinition
(TableName tableName, List<TableDefinition.Column> columns, Persistence persistence) Creates a newTableDefinition
with the given columns and persistence. -
Method Summary
Modifier and TypeMethodDescriptionaddColumn
(TableDefinition.Column column) Adds a column to the table definition.Adds a column to the table definition.addColumn
(String columnName, SqlType type, Nullability nullability) Adds a column to the table definition.Adds a column to the table definition.addColumn
(String columnName, SqlType type, String collation, Nullability nullability) Adds a column to the table definition.getColumn
(int position) Returns a column by position.getColumnByName
(Name columnName) Retrieves the column named "columnName", if it exists.getColumnByName
(String columnName) Retrieves the column named "columnName", if it exists.int
Returns the number of columns.getColumnPositionByName
(Name columnName) Retrieves the column position of a column named "columnName", if it exists.getColumnPositionByName
(String columnName) Retrieves the column position of a column named "columnName", if it exists.Returns all columns.Returns the persistence of the table.Returns the name of the table.setPersistence
(Persistence persistence) Sets the table persistence.setTableName
(TableName tableName) Sets the table name.
-
Constructor Details
-
TableDefinition
public TableDefinition(TableName tableName, List<TableDefinition.Column> columns, Persistence persistence) Creates a newTableDefinition
with the given columns and persistence.- Parameters:
tableName
- The table name.columns
- The columns.persistence
- The persistence.
-
TableDefinition
Creates a newTableDefinition
of permanent persistence with the given columns.- Parameters:
tableName
- The table name.columns
- The columns.
-
TableDefinition
Creates a new, emptyTableDefinition
with the given persistence.- Parameters:
tableName
- The table name.persistence
- The persistence.
-
TableDefinition
Creates a new, emptyTableDefinition
of permanent persistence.- Parameters:
tableName
- The table name.
-
-
Method Details
-
getColumns
Returns all columns.- Returns:
- The columns.
-
getColumn
Returns a column by position.- Parameters:
position
- The position starting at 0.- Returns:
- The column.
-
getColumnByName
Retrieves the column named "columnName", if it exists.- Parameters:
columnName
- The name of the column to retrieve.- Returns:
- The column if it exists.
-
getColumnByName
Retrieves the column named "columnName", if it exists.- Parameters:
columnName
- The name of the column to retrieve.- Returns:
- The column if it exists.
-
getColumnPositionByName
Retrieves the column position of a column named "columnName", if it exists.- Parameters:
columnName
- The name of the column to retrieve.- Returns:
- The position of the column if it exists.
-
getColumnPositionByName
Retrieves the column position of a column named "columnName", if it exists.- Parameters:
columnName
- The name of the column to retrieve.- Returns:
- The position of the column if it exists.
-
getColumnCount
public int getColumnCount()Returns the number of columns.- Returns:
- The number of columns.
-
getTableName
Returns the name of the table.- Returns:
- The table name.
-
setTableName
Sets the table name.- Parameters:
tableName
- The new table name.- Returns:
- The table definition for method chaining.
-
getPersistence
Returns the persistence of the table.- Returns:
- The persistence.
-
setPersistence
Sets the table persistence.- Parameters:
persistence
- The new table persistence.- Returns:
- The table definition for method chaining.
-
addColumn
Adds a column to the table definition.- Parameters:
column
- The column to add.- Returns:
- The table definition for method chaining.
-
addColumn
public TableDefinition addColumn(String columnName, SqlType type, String collation, Nullability nullability) Adds a column to the table definition.- Parameters:
columnName
- Column name.type
- SQL type.collation
- Collation (used for sorting and equality checks).nullability
- Whether the column should allow null values.- Returns:
- The table definition for method chaining.
-
addColumn
Adds a column to the table definition.- Parameters:
columnName
- Column name.type
- SQL type.collation
- Collation (used for sorting and equality checks).- Returns:
- The table definition for method chaining.
-
addColumn
Adds a column to the table definition.- Parameters:
columnName
- Column name.type
- SQL type.nullability
- Whether the column should allow null values.- Returns:
- The table definition for method chaining.
-
addColumn
Adds a column to the table definition.- Parameters:
columnName
- Column name.type
- SQL type.- Returns:
- The table definition for method chaining.
-