Package com.tableau.hyperapi
Class TableDefinition
- java.lang.Object
-
- com.tableau.hyperapi.TableDefinition
-
public final class TableDefinition extends java.lang.Object
The schema of a table.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TableDefinition.Column
A single column.
-
Constructor Summary
Constructors Constructor Description TableDefinition(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, java.util.List<TableDefinition.Column> columns)
Creates a newTableDefinition
of permanent persistence with the given columns.TableDefinition(TableName tableName, java.util.List<TableDefinition.Column> columns, Persistence persistence)
Creates a newTableDefinition
with the given columns and persistence.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TableDefinition
addColumn(TableDefinition.Column column)
Adds a column to the table definition.TableDefinition
addColumn(java.lang.String columnName, SqlType type)
Adds a column to the table definition.TableDefinition
addColumn(java.lang.String columnName, SqlType type, Nullability nullability)
Adds a column to the table definition.TableDefinition
addColumn(java.lang.String columnName, SqlType type, java.lang.String collation)
Adds a column to the table definition.TableDefinition
addColumn(java.lang.String columnName, SqlType type, java.lang.String collation, Nullability nullability)
Adds a column to the table definition.TableDefinition.Column
getColumn(int position)
Returns a column by position.java.util.Optional<TableDefinition.Column>
getColumnByName(Name columnName)
Retrieves the column named "columnName", if it exists.java.util.Optional<TableDefinition.Column>
getColumnByName(java.lang.String columnName)
Retrieves the column named "columnName", if it exists.int
getColumnCount()
Returns the number of columns.java.util.OptionalInt
getColumnPositionByName(Name columnName)
Retrieves the column position of a column named "columnName", if it exists.java.util.OptionalInt
getColumnPositionByName(java.lang.String columnName)
Retrieves the column position of a column named "columnName", if it exists.java.util.List<TableDefinition.Column>
getColumns()
Returns all columns.Persistence
getPersistence()
Returns the persistence of the table.TableName
getTableName()
Returns the name of the table.TableDefinition
setPersistence(Persistence persistence)
Sets the table persistence.TableDefinition
setTableName(TableName tableName)
Sets the table name.
-
-
-
Constructor Detail
-
TableDefinition
public TableDefinition(TableName tableName, java.util.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
public TableDefinition(TableName tableName, java.util.List<TableDefinition.Column> columns)
Creates a newTableDefinition
of permanent persistence with the given columns.- Parameters:
tableName
- The table name.columns
- The columns.
-
TableDefinition
public TableDefinition(TableName tableName, Persistence persistence)
Creates a new, emptyTableDefinition
with the given persistence.- Parameters:
tableName
- The table name.persistence
- The persistence.
-
TableDefinition
public TableDefinition(TableName tableName)
Creates a new, emptyTableDefinition
of permanent persistence.- Parameters:
tableName
- The table name.
-
-
Method Detail
-
getColumns
public java.util.List<TableDefinition.Column> getColumns()
Returns all columns.- Returns:
- The columns.
-
getColumn
public TableDefinition.Column getColumn(int position)
Returns a column by position.- Parameters:
position
- The position starting at 0.- Returns:
- The column.
-
getColumnByName
public java.util.Optional<TableDefinition.Column> getColumnByName(java.lang.String columnName)
Retrieves the column named "columnName", if it exists.- Parameters:
columnName
- The name of the column to retrieve.- Returns:
- The column if it exists.
-
getColumnByName
public java.util.Optional<TableDefinition.Column> getColumnByName(Name columnName)
Retrieves the column named "columnName", if it exists.- Parameters:
columnName
- The name of the column to retrieve.- Returns:
- The column if it exists.
-
getColumnPositionByName
public java.util.OptionalInt getColumnPositionByName(java.lang.String columnName)
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
public java.util.OptionalInt getColumnPositionByName(Name columnName)
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
public TableName getTableName()
Returns the name of the table.- Returns:
- The table name.
-
setTableName
public TableDefinition setTableName(TableName tableName)
Sets the table name.- Parameters:
tableName
- The new table name.- Returns:
- The table definition for method chaining.
-
getPersistence
public Persistence getPersistence()
Returns the persistence of the table.- Returns:
- The persistence.
-
setPersistence
public TableDefinition setPersistence(Persistence persistence)
Sets the table persistence.- Parameters:
persistence
- The new table persistence.- Returns:
- The table definition for method chaining.
-
addColumn
public TableDefinition addColumn(TableDefinition.Column column)
Adds a column to the table definition.- Parameters:
column
- The column to add.- Returns:
- The table definition for method chaining.
-
addColumn
public TableDefinition addColumn(java.lang.String columnName, SqlType type, java.lang.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
public TableDefinition addColumn(java.lang.String columnName, SqlType type, java.lang.String collation)
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
public TableDefinition addColumn(java.lang.String columnName, SqlType type, Nullability nullability)
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
public TableDefinition addColumn(java.lang.String columnName, SqlType type)
Adds a column to the table definition.- Parameters:
columnName
- Column name.type
- SQL type.- Returns:
- The table definition for method chaining.
-
-