Package com.exasol.dbbuilder.dialects
Class AbstractSchema
- java.lang.Object
-
- com.exasol.dbbuilder.dialects.AbstractDatabaseObject
-
- com.exasol.dbbuilder.dialects.AbstractSchema
-
- All Implemented Interfaces:
DatabaseObject
,Schema
- Direct Known Subclasses:
ExasolSchema
,MySqlSchema
,OracleSchema
,PostgreSqlSchema
public abstract class AbstractSchema extends AbstractDatabaseObject implements Schema
This class contains common logic for a database schema.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSchema(com.exasol.db.Identifier name)
Create a new database schema.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Table
createTable(String name, String column1Name, String column1Type)
Create a table with one column.Table
createTable(String name, String column1Name, String column1Type, String column2Name, String column2Type)
Create a table with two columns.Table
createTable(String name, String column1Name, String column1Type, String column2Name, String column2Type, String column3Name, String column3Type)
Create a table with three columns.Table
createTable(String name, List<String> columnNames, List<String> columnTypes)
Create a table with an arbitrary number of columns.Table.Builder
createTableBuilder(String name)
Create a builder for a table.void
drop()
Drop the database object and all contained objects.protected abstract com.exasol.db.Identifier
getIdentifier(String name)
Get an instance ofIdentifier
.List<Table>
getTables()
Get the tables inside this schema.protected abstract DatabaseObjectWriter
getWriter()
Get aDatabaseObjectWriter
.protected void
passColumnsToTableBuilder(List<String> columnNames, List<String> columnTypes, Table.Builder builder)
Method that passes in a list of column names, and a list of their types, into a table builder.-
Methods inherited from class com.exasol.dbbuilder.dialects.AbstractDatabaseObject
getFullyQualifiedName, getName, isOwned
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.exasol.dbbuilder.dialects.DatabaseObject
getFullyQualifiedName, getName, isOwned
-
-
-
-
Method Detail
-
getWriter
protected abstract DatabaseObjectWriter getWriter()
Get aDatabaseObjectWriter
.- Returns:
DatabaseObjectWriter
-
getTables
public List<Table> getTables()
Description copied from interface:Schema
Get the tables inside this schema.
-
createTable
public Table createTable(String name, String column1Name, String column1Type)
Description copied from interface:Schema
Create a table with one column.- Specified by:
createTable
in interfaceSchema
- Parameters:
name
- name of the tablecolumn1Name
- name of the first columncolumn1Type
- type of the first column- Returns:
- table
-
createTable
public Table createTable(String name, String column1Name, String column1Type, String column2Name, String column2Type)
Description copied from interface:Schema
Create a table with two columns.- Specified by:
createTable
in interfaceSchema
- Parameters:
name
- name of the tablecolumn1Name
- name of the first columncolumn1Type
- type of the first columncolumn2Name
- name of the second columncolumn2Type
- type of the second column- Returns:
- table
-
createTable
public Table createTable(String name, String column1Name, String column1Type, String column2Name, String column2Type, String column3Name, String column3Type)
Description copied from interface:Schema
Create a table with three columns.- Specified by:
createTable
in interfaceSchema
- Parameters:
name
- name of the tablecolumn1Name
- name of the first columncolumn1Type
- type of the first columncolumn2Name
- name of the second columncolumn2Type
- type of the second columncolumn3Name
- name of the third columncolumn3Type
- type of the third column- Returns:
- table
-
createTableBuilder
public Table.Builder createTableBuilder(String name)
Description copied from interface:Schema
Create a builder for a table.In cases where you need a more complex table that can be created by the convenience methods
createTable
, this method provides a builder.- Specified by:
createTableBuilder
in interfaceSchema
- Parameters:
name
- table name- Returns:
- builder for the table
-
createTable
public Table createTable(String name, List<String> columnNames, List<String> columnTypes)
Description copied from interface:Schema
Create a table with an arbitrary number of columns.- Specified by:
createTable
in interfaceSchema
- Parameters:
name
- name of the tablecolumnNames
- list of column namescolumnTypes
- list of column types- Returns:
- table
-
passColumnsToTableBuilder
protected void passColumnsToTableBuilder(List<String> columnNames, List<String> columnTypes, Table.Builder builder)
Method that passes in a list of column names, and a list of their types, into a table builder.- Parameters:
columnNames
- the column namescolumnTypes
- the column typesbuilder
- the builder that gets the information passed in
-
getIdentifier
protected abstract com.exasol.db.Identifier getIdentifier(String name)
Get an instance ofIdentifier
.- Parameters:
name
- identifier id- Returns:
- instance of
Identifier
-
drop
public void drop()
Description copied from interface:DatabaseObject
Drop the database object and all contained objects.- Specified by:
drop
in interfaceDatabaseObject
-
-