com.github.drinkjava2.jdialects.model
Class Table

java.lang.Object
  extended by com.github.drinkjava2.jdialects.model.Table

public class Table
extends Object

The platform-independent table model

Since:
1.0.2
Author:
Yong Zhu

Constructor Summary
Table()
           
Table(String tableName)
           
 
Method Summary
 Table addColumn(Column column)
          Add a column definition piece in DDL
 void addSequence(Sequence sequence)
          Add a sequence definition DDL
 void addSequence(String name, String sequenceName, Integer initialValue, Integer allocationSize)
          Add a sequence definition DDL, note: some dialects do not support sequence
 void addTableGenerator(String name, String tableName, String pkColumnName, String valueColumnName, String pkColumnValue, Integer initialValue, Integer allocationSize)
          Add a "create table..." DDL to generate ID, similar like JPA's TableGenerator
 void addTableGenerator(TableGenerator tableGenerator)
          Add a "create table..." DDL to generate ID, similar like JPA's TableGenerator
 Table check(String check)
          Add the table check String DDL piece if support
 Column column(String columnName)
          Start add a column definition piece in DDL, detail usage see demo
 Table comment(String comment)
          Add the table comment String DDL piece if support
 Table engineTail(String engineTail)
          If support engine like MySQL or MariaDB, add engineTail at the end of "create table..." DDL, usually used to set encode String like " DEFAULT CHARSET=utf8" for MySQL
 FKeyConstraint fkey(String... columnNames)
          Start add a full foreign key definition in DDL, detail usage see demo
 String getCheck()
           
 Column getColumn(String columnName)
          Return Column object by columnName
 Map<String,Column> getColumns()
           
 String getComment()
           
 String getEngineTail()
           
 List<FKeyConstraint> getFkeyConstraints()
           
 Map<String,Sequence> getSequences()
           
 Map<String,TableGenerator> getTableGenerators()
           
 String getTableName()
           
 void setCheck(String check)
           
 void setColumns(Map<String,Column> columns)
           
 void setComment(String comment)
           
 void setEngineTail(String engineTail)
           
 void setFkeyConstraints(List<FKeyConstraint> fkeyConstraints)
           
 void setSequences(Map<String,Sequence> sequences)
           
 void setTableGenerators(Map<String,TableGenerator> tableGenerators)
           
 void setTableName(String tableName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Table

public Table()

Table

public Table(String tableName)
Method Detail

addTableGenerator

public void addTableGenerator(TableGenerator tableGenerator)
Add a "create table..." DDL to generate ID, similar like JPA's TableGenerator


addTableGenerator

public void addTableGenerator(String name,
                              String tableName,
                              String pkColumnName,
                              String valueColumnName,
                              String pkColumnValue,
                              Integer initialValue,
                              Integer allocationSize)
Add a "create table..." DDL to generate ID, similar like JPA's TableGenerator

Parameters:
name - The name of TableGenerator Java object itself
tableName - The name of the table will created in database to generate ID
pkColumnName - The name of prime key column
valueColumnName - The name of value column
pkColumnValue - The value in prime key column
initialValue - The initial value
allocationSize - The allocationSize

addSequence

public void addSequence(String name,
                        String sequenceName,
                        Integer initialValue,
                        Integer allocationSize)
Add a sequence definition DDL, note: some dialects do not support sequence

Parameters:
name - The name of sequence Java object itself
sequenceName - the name of the sequence will created in database
initialValue - The initial value
allocationSize - The allocationSize

addSequence

public void addSequence(Sequence sequence)
Add a sequence definition DDL


check

public Table check(String check)
Add the table check String DDL piece if support


comment

public Table comment(String comment)
Add the table comment String DDL piece if support


addColumn

public Table addColumn(Column column)
Add a column definition piece in DDL


column

public Column column(String columnName)
Start add a column definition piece in DDL, detail usage see demo

Parameters:
columnName -
Returns:
the Column object

getColumn

public Column getColumn(String columnName)
Return Column object by columnName


fkey

public FKeyConstraint fkey(String... columnNames)
Start add a full foreign key definition in DDL, detail usage see demo


engineTail

public Table engineTail(String engineTail)
If support engine like MySQL or MariaDB, add engineTail at the end of "create table..." DDL, usually used to set encode String like " DEFAULT CHARSET=utf8" for MySQL


getTableName

public String getTableName()

setTableName

public void setTableName(String tableName)

getCheck

public String getCheck()

setCheck

public void setCheck(String check)

getComment

public String getComment()

setComment

public void setComment(String comment)

getColumns

public Map<String,Column> getColumns()

setColumns

public void setColumns(Map<String,Column> columns)

getSequences

public Map<String,Sequence> getSequences()

setSequences

public void setSequences(Map<String,Sequence> sequences)

getTableGenerators

public Map<String,TableGenerator> getTableGenerators()

setTableGenerators

public void setTableGenerators(Map<String,TableGenerator> tableGenerators)

getFkeyConstraints

public List<FKeyConstraint> getFkeyConstraints()

setFkeyConstraints

public void setFkeyConstraints(List<FKeyConstraint> fkeyConstraints)

getEngineTail

public String getEngineTail()

setEngineTail

public void setEngineTail(String engineTail)


Copyright © 2017. All rights reserved.