|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.github.drinkjava2.jdialects.model.TableModel
public class TableModel
A TableModel definition represents a platform dependent Database Table, from 1.0.5 this class name changed from "Table" to "TableModel" to avoid naming conflict to JPA's "@Table" annotation
| Constructor Summary | |
|---|---|
TableModel()
|
|
TableModel(String tableName)
|
|
| Method Summary | |
|---|---|
TableModel |
addColumn(ColumnModel column)
Add a ColumnModel |
ColumnModel |
addColumn(String columnName)
Add a column with given columnName to tableModel |
void |
addGenerator(IdGenerator generator)
Add a "create table..." DDL to generate ID, similar like JPA's TableGen |
TableModel |
check(String check)
Add the table check, note: not all database support table check |
ColumnModel |
column(String columnName)
find column in tableModel by given columnName, if not found, add a new column with columnName |
TableModel |
comment(String comment)
Add the table comment, note: not all database support table comment |
TableModel |
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 |
FKeyModel |
fkey()
Start add a foreign key definition in DDL, detail usage see demo |
FKeyModel |
fkey(String fkeyName)
Start add a foreign key definition in DDL, detail usage see demo |
protected void |
getAndSetters____________________________()
|
String |
getCheck()
|
ColumnModel |
getColumn(String colOrFieldName)
Get ColumnModel by column Name or field name ignore case, if not found, return null |
ColumnModel |
getColumnByColName(String colName)
Get ColumnModel by columnName ignore case, if not found, return null |
ColumnModel |
getColumnByFieldName(String fieldName)
Get ColumnModel by entity field name ignore case, if not found, return null |
List<ColumnModel> |
getColumns()
|
String |
getComment()
|
String |
getDebugInfo()
|
String |
getEngineTail()
|
Class<?> |
getEntityClass()
|
ColumnModel |
getFirstPKeyColumn()
|
FKeyModel |
getFkey(String fkeyName)
Get a FKeyModel by given fkeyName |
List<FKeyModel> |
getFkeyConstraints()
|
IdGenerator |
getIdGenerator(GenerationType generationType)
Get one of these IdGenerator instance by generationType: IDENTITY,AUTO,UUID25,UUID32,UUID36,TIMESTAMP |
IdGenerator |
getIdGenerator(GenerationType generationType,
String name)
Search and return the IdGenerator in this TableModel by its generationType and name |
static IdGenerator |
getIdGenerator(GenerationType generationType,
String name,
List<IdGenerator> idGeneratorList)
Get a IdGenerator by type, if not found, search by name |
IdGenerator |
getIdGenerator(String name)
Search and return the IdGenerator in this TableModel by its name |
static IdGenerator |
getIdGeneratorByType(GenerationType generationType)
Get one of these IdGenerator instance by generationType: IDENTITY,AUTO,UUID25,UUID32,UUID36,TIMESTAMP, if not found , return null; |
List<IdGenerator> |
getIdGenerators()
|
List<IndexModel> |
getIndexConsts()
|
List<ColumnModel> |
getPKeyColsSortByColumnName()
Get pkey columns sorted by column name |
int |
getPKeyCount()
|
Boolean |
getReadOnly()
|
ColumnModel |
getShardDatabaseColumn()
|
ColumnModel |
getShardTableColumn()
|
String |
getTableName()
|
List<UniqueModel> |
getUniqueConsts()
|
IndexModel |
index()
Start add a Index in DDL, detail usage see demo |
IndexModel |
index(String indexName)
Start add a Index in DDL, detail usage see demo |
TableModel |
newCopy()
|
TableModel |
removeColumn(String columnName)
Remove a ColumnModel by given columnName |
TableModel |
removeFKey(String fkeyName)
Remove a FKey by given fkeyName |
void |
sequenceGenerator(String name,
String sequenceName,
Integer initialValue,
Integer allocationSize)
Add a sequence definition DDL, note: some dialects do not support sequence |
void |
setCheck(String check)
|
void |
setColumns(List<ColumnModel> columns)
|
void |
setComment(String comment)
|
void |
setEngineTail(String engineTail)
|
void |
setEntityClass(Class<?> entityClass)
|
void |
setFkeyConstraints(List<FKeyModel> fkeyConstraints)
|
void |
setIdGenerators(List<IdGenerator> idGenerators)
|
void |
setIndexConsts(List<IndexModel> indexConsts)
|
void |
setReadOnly(Boolean readOnly)
|
void |
setTableName(String tableName)
|
void |
setUniqueConsts(List<UniqueModel> uniqueConsts)
|
void |
sortedUUIDGenerator(String name,
Integer sortedLength,
Integer uuidLength)
Add a Sequence Generator, note: not all database support sequence |
void |
tableGenerator(String name,
String tableName,
String pkColumnName,
String valueColumnName,
String pkColumnValue,
Integer initialValue,
Integer allocationSize)
Add a TableGenerator |
UniqueModel |
unique()
Start add a unique constraint in DDL, detail usage see demo |
UniqueModel |
unique(String uniqueName)
Start add a unique constraint in DDL, detail usage see demo |
void |
uuidAny(String name,
Integer length)
Add a UUIDAnyGenerator |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TableModel()
public TableModel(String tableName)
| Method Detail |
|---|
public TableModel newCopy()
public void tableGenerator(String name,
String tableName,
String pkColumnName,
String valueColumnName,
String pkColumnValue,
Integer initialValue,
Integer allocationSize)
public void uuidAny(String name,
Integer length)
public void addGenerator(IdGenerator generator)
public void sequenceGenerator(String name,
String sequenceName,
Integer initialValue,
Integer allocationSize)
name - The name of sequence Java object itselfsequenceName - the name of the sequence will created in databaseinitialValue - The initial valueallocationSize - The allocationSize
public void sortedUUIDGenerator(String name,
Integer sortedLength,
Integer uuidLength)
public TableModel check(String check)
public TableModel comment(String comment)
public TableModel addColumn(ColumnModel column)
public TableModel removeColumn(String columnName)
public TableModel removeFKey(String fkeyName)
public ColumnModel column(String columnName)
public ColumnModel addColumn(String columnName)
columnName -
public ColumnModel getColumn(String colOrFieldName)
public ColumnModel getColumnByColName(String colName)
public ColumnModel getColumnByFieldName(String fieldName)
public ColumnModel getShardTableColumn()
public ColumnModel getShardDatabaseColumn()
public FKeyModel fkey()
public FKeyModel fkey(String fkeyName)
public FKeyModel getFkey(String fkeyName)
public IndexModel index()
public IndexModel index(String indexName)
public UniqueModel unique()
public UniqueModel unique(String uniqueName)
public TableModel engineTail(String engineTail)
public IdGenerator getIdGenerator(GenerationType generationType,
String name)
public IdGenerator getIdGenerator(GenerationType generationType)
public IdGenerator getIdGenerator(String name)
public static IdGenerator getIdGeneratorByType(GenerationType generationType)
public static IdGenerator getIdGenerator(GenerationType generationType,
String name,
List<IdGenerator> idGeneratorList)
public int getPKeyCount()
public ColumnModel getFirstPKeyColumn()
public List<ColumnModel> getPKeyColsSortByColumnName()
public String getDebugInfo()
protected void getAndSetters____________________________()
public String getTableName()
public void setTableName(String tableName)
public String getCheck()
public void setCheck(String check)
public String getComment()
public void setComment(String comment)
public List<ColumnModel> getColumns()
public void setColumns(List<ColumnModel> columns)
public List<FKeyModel> getFkeyConstraints()
public void setFkeyConstraints(List<FKeyModel> fkeyConstraints)
public String getEngineTail()
public void setEngineTail(String engineTail)
public List<IndexModel> getIndexConsts()
public void setIndexConsts(List<IndexModel> indexConsts)
public List<UniqueModel> getUniqueConsts()
public void setUniqueConsts(List<UniqueModel> uniqueConsts)
public List<IdGenerator> getIdGenerators()
public void setIdGenerators(List<IdGenerator> idGenerators)
public Class<?> getEntityClass()
public void setEntityClass(Class<?> entityClass)
public Boolean getReadOnly()
public void setReadOnly(Boolean readOnly)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||