org.sql.generation.api.grammar.factories
Interface DefinitionFactory


public interface DefinitionFactory

This is factory for creating builders and syntax elements related to SQL Data Definition (typically CREATE statements).

Author:
Stanislav Muhametsin

Method Summary
 CheckConstraint createCheckConstraint(BooleanExpression check)
          Creates a CHECK clause, typically used in CREATE TABLE statements.
 ColumnDefinition createColumnDefinition(String columnName, SQLDataType columnDataType)
          Creates a new definition of column with specified name and data type.
 ColumnDefinition createColumnDefinition(String columnName, SQLDataType columnDataType, Boolean mayBeNull)
          Creates a new definition of column with specified name, data type, and NULL value policy.
 ColumnDefinition createColumnDefinition(String columnName, SQLDataType columnDataType, Boolean mayBeNull, AutoGenerationPolicy autoGenerationPolicy)
          Creates a new definition of column with specified name, data type, NULL value policy, and auto generation policy.
 ColumnDefinition createColumnDefinition(String columnName, SQLDataType columnDataType, String columnDefault)
          Creates a new definition of column with specified name, data type, default value.
 ColumnDefinition createColumnDefinition(String columnName, SQLDataType columnDataType, String columnDefault, Boolean mayBeNull)
          Creates a new definition of column with specified name, data type, default value, and NULL value policy.
 ForeignKeyConstraintBuilder createForeignKeyConstraintBuilder()
          Creates an empty builder for FOREIGN KEY constraint, typically used in CREATE TABLE statements.
 LikeClause createLikeClause(TableNameDirect tableName)
          Creates a new LIKE <table name> clause for CREATE TABLE statement.
 RegularViewSpecification createRegularViewSpecification(String... columnNames)
          Creates a new view specification with given columns.
 SchemaDefinitionBuilder createSchemaDefinitionBuilder()
          Creates an empty builder for CREATE SCHEMA statement.
 TableConstraintDefinition createTableConstraintDefinition(String name, TableConstraint constraint)
          Creates a new, named table constraint without any ConstraintCharacteristics.
 TableConstraintDefinition createTableConstraintDefinition(String name, TableConstraint constraint, ConstraintCharacteristics characteristics)
          Creates a new named table constraint with specified ConstraintCharacteristics.
 TableConstraintDefinition createTableConstraintDefinition(TableConstraint constraint)
          Creates a new unnamed table constraint without any ConstraintCharacteristics.
 TableConstraintDefinition createTableConstraintDefinition(TableConstraint constraint, ConstraintCharacteristics characteristics)
          Creates a new unnamed table constraint with specified ConstraintCharacteristics.
 TableDefinitionBuilder createTableDefinitionBuilder()
          Creates an empty builder for CREATE TABLE statement.
 TableElementListBuilder createTableElementListBuilder()
          Creates an empty builder for defining columns and constraints for CREATE TABLE statement.
 UniqueConstraintBuilder createUniqueConstraintBuilder()
          Creates an empty builder for unique constraint (either UNIQUE(columns...) or PRIMARY KEY(columns...)), typically used in CREATE TABLE statements.
 ViewDefinitionBuilder createViewDefinitionBuilder()
          Creates an empty builder for CREATE VIEW statement.
 

Method Detail

createSchemaDefinitionBuilder

SchemaDefinitionBuilder createSchemaDefinitionBuilder()
Creates an empty builder for CREATE SCHEMA statement.

Returns:
An empty builder for CREATE SCHEMA statement.

createTableDefinitionBuilder

TableDefinitionBuilder createTableDefinitionBuilder()
Creates an empty builder for CREATE TABLE statement.

Returns:
An empty builder for CREATE TABLE statement.

createTableElementListBuilder

TableElementListBuilder createTableElementListBuilder()
Creates an empty builder for defining columns and constraints for CREATE TABLE statement.

Returns:
An empty builder for defining columns and constraints for CREATE TABLE statement.
See Also:
TableDefinition

createColumnDefinition

ColumnDefinition createColumnDefinition(String columnName,
                                        SQLDataType columnDataType)
Creates a new definition of column with specified name and data type. Invoking this method is equivalent to invoking #createColumnDefinition(String, String, String, Boolean) and pass null and true as last two parameters (meaning that there is no default value for column, and it may have NULL values).

Parameters:
columnName - The name of the column.
columnDataType - The data type of the column.
Returns:
The syntax element for definition of column with specified name and data type.
See Also:
#createColumnDefinition(String, String, String, Boolean)

createColumnDefinition

ColumnDefinition createColumnDefinition(String columnName,
                                        SQLDataType columnDataType,
                                        Boolean mayBeNull)
Creates a new definition of column with specified name, data type, and NULL value policy. Invoking this method is equivalent to invoking #createColumnDefinition(String, String, String, Boolean) and pass null and mayBeNull as last two parameters (meaning that there is no default value for column).

Parameters:
columnName - The name of the column.
columnDataType - The data type of the column.
mayBeNull - The NULL value policy. Setting this to false is same as specifying NOT NULL in column definition in SQL.
Returns:
The syntax element for definition of column with specified name, data type, and NULL value policy.
See Also:
#createColumnDefinition(String, String, String, Boolean)

createColumnDefinition

ColumnDefinition createColumnDefinition(String columnName,
                                        SQLDataType columnDataType,
                                        String columnDefault)
Creates a new definition of column with specified name, data type, default value. Invoking this method is equivalent to invoking #createColumnDefinition(String, String, String, Boolean) and pass columnDefault and true as last two parameters (meaning that column may have NULL values).

Parameters:
columnName - The name of the column.
columnDataType - The data type of the column.
columnDefault - The default value of the column.
Returns:
The syntax element for definition of column with specified name, data type, default value.
See Also:
#createColumnDefinition(String, String, String, Boolean)

createColumnDefinition

ColumnDefinition createColumnDefinition(String columnName,
                                        SQLDataType columnDataType,
                                        String columnDefault,
                                        Boolean mayBeNull)
Creates a new definition of column with specified name, data type, default value, and NULL value policy. Invoking this method is equivalent to invoking #createColumnDefinition(String, SQLDataType, String, Boolean, AutoGenerationPolicy) and pass null as last parameter.

Parameters:
columnName - The name of the column.
columnDataType - The data type of the column.
columnDefault - The default value of the column.
mayBeNull - The NULL value policy for the column. Setting this to false is same as specifying NOT NULL in column definition in SQL.
Returns:
The syntax element for definition of column with specified name, data type, default value, and NULL value policy.

createColumnDefinition

ColumnDefinition createColumnDefinition(String columnName,
                                        SQLDataType columnDataType,
                                        Boolean mayBeNull,
                                        AutoGenerationPolicy autoGenerationPolicy)
Creates a new definition of column with specified name, data type, NULL value policy, and auto generation policy.

Parameters:
columnName - The name of the column.
columnDataType - The data type of the column.
mayBeNull - The NULL value policy for the column. Setting this to false is same as specifying NOT NULL in column definition in SQL.
autoGenerationPolicy - The policy for auto generation for this column. Should be null if the column should not be marked as automatically generated.
Returns:
The syntax element for definition of column with specified name, data type, default value, NULL value policy, and auto generation policy.

createLikeClause

LikeClause createLikeClause(TableNameDirect tableName)
Creates a new LIKE <table name> clause for CREATE TABLE statement.

Parameters:
tableName - The name of the target table.
Returns:
The syntax element for LIKE <table name> clause for CREATE TABLE statement.

createTableConstraintDefinition

TableConstraintDefinition createTableConstraintDefinition(TableConstraint constraint)
Creates a new unnamed table constraint without any ConstraintCharacteristics. Invoking this method is equivalent to invoking createTableConstraintDefinition(String, TableConstraint, ConstraintCharacteristics) and passing nulls as first and last parameters.

Parameters:
constraint - The constraint for the table.
Returns:
The syntax element for unnamed table constraint without any ConstraintCharacteristics.
See Also:
#createColumnDefinition(String, String, String, Boolean)

createTableConstraintDefinition

TableConstraintDefinition createTableConstraintDefinition(String name,
                                                          TableConstraint constraint)
Creates a new, named table constraint without any ConstraintCharacteristics. Invoking this method is equivalent to invoking createTableConstraintDefinition(String, TableConstraint, ConstraintCharacteristics) and passing null as last parameter.

Parameters:
name - The name for the constraint.
constraint - The constraint for the table.
Returns:
The syntax element for named table constraint without any ConstraintCharacteristics.
See Also:
#createColumnDefinition(String, String, String, Boolean)

createTableConstraintDefinition

TableConstraintDefinition createTableConstraintDefinition(TableConstraint constraint,
                                                          ConstraintCharacteristics characteristics)
Creates a new unnamed table constraint with specified ConstraintCharacteristics. Invoking this method is equivalent to invoking createTableConstraintDefinition(String, TableConstraint, ConstraintCharacteristics) and passing null as first parameter.

Parameters:
constraint - The constraint for the table.
characteristics - The constraint characteristics for the constraint.
Returns:
The syntax element for unnamed table constraint with specified ConstraintCharacteristics.
See Also:
#createColumnDefinition(String, String, String, Boolean), ConstraintCharacteristics

createTableConstraintDefinition

TableConstraintDefinition createTableConstraintDefinition(String name,
                                                          TableConstraint constraint,
                                                          ConstraintCharacteristics characteristics)
Creates a new named table constraint with specified ConstraintCharacteristics.

Parameters:
name - The name for the constraint.
constraint - The constraint for the table.
characteristics - The characteristics for the constraint.
Returns:
The syntax element for named table constraint with specified ConstraintCharacteristics.
See Also:
ConstraintCharacteristics

createCheckConstraint

CheckConstraint createCheckConstraint(BooleanExpression check)
Creates a CHECK clause, typically used in CREATE TABLE statements.

Parameters:
check - The boolean expression for check.
Returns:
The syntax element for CHECK clause, typically used in CREATE TABLE statements.

createUniqueConstraintBuilder

UniqueConstraintBuilder createUniqueConstraintBuilder()
Creates an empty builder for unique constraint (either UNIQUE(columns...) or PRIMARY KEY(columns...)), typically used in CREATE TABLE statements.

Returns:
An empty builder for unique constraints (either UNIQUE(columns...) or PRIMARY KEY(columns...)).

createForeignKeyConstraintBuilder

ForeignKeyConstraintBuilder createForeignKeyConstraintBuilder()
Creates an empty builder for FOREIGN KEY constraint, typically used in CREATE TABLE statements.

Returns:
An empty builder for FOREIGN KEY constraint.
See Also:
ForeignKeyConstraintBuilder, ForeignKeyConstraint

createViewDefinitionBuilder

ViewDefinitionBuilder createViewDefinitionBuilder()
Creates an empty builder for CREATE VIEW statement.

Returns:
An empty builder for CREATE VIEW statement.
See Also:
ViewDefinitionBuilder, ViewDefinition

createRegularViewSpecification

RegularViewSpecification createRegularViewSpecification(String... columnNames)
Creates a new view specification with given columns. Must have at least one column.

Parameters:
columnNames - The names of the columns.
Returns:
A new RegularViewSpecification.
See Also:
RegularViewSpecification


Copyright © 2010-2012. All Rights Reserved.