com.github.drinkjava2.jdialects.model
Class ColumnModel

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

public class ColumnModel
extends Object

A ColumnModel definition represents a platform dependent column in a Database Table, from 1.0.5 this class name changed from "Column" to "ColumnModel" to avoid naming conflict to JPA's "@Column" annotation

Since:
1.0.0
Author:
Yong Zhu

Constructor Summary
ColumnModel(String columnName)
           
 
Method Summary
 ColumnModel autoId()
          Bind column to a global Auto Id generator, can be Sequence or a Table
 ColumnModel BIGDECIMAL(Integer precision, Integer scale)
           
 ColumnModel BIGINT()
           
 ColumnModel BINARY(Integer... lengths)
           
 ColumnModel BIT()
           
 ColumnModel BLOB(Integer... lengths)
           
 ColumnModel BOOLEAN()
           
 ColumnModel CHAR(Integer... lengths)
           
 ColumnModel check(String check)
          Add a column check DDL piece if support
 void checkReadOnly()
           
 ColumnModel CLOB(Integer... lengths)
           
 ColumnModel comment(String comment)
          Add comments at end of column definition DDL
 ColumnModel DATE()
           
 ColumnModel DECIMAL(Integer... lengths)
           
 ColumnModel defaultValue(String value)
          Default value for column's definition DDL
 ColumnModel DOUBLE()
           
 ColumnModel entityField(String entityFieldName)
          Mark this column map to a Java entity field, if exist other columns map to this field, delete other columns.
 ColumnModel FLOAT(Integer... lengths)
           
 String getCheck()
           
 String getColumnName()
           
 Type getColumnType()
           
 String getComment()
           
 String getDebugInfo()
           
 String getDefaultValue()
           
 String getEntityField()
           
 GenerationType getIdGenerationType()
           
 IdGenerator getIdGenerator()
           
 String getIdGeneratorName()
           
 Boolean getInsertable()
           
 Integer getLength()
           
 Integer[] getLengths()
           
 Boolean getNullable()
           
 Boolean getPkey()
           
 Integer getPrecision()
           
 Integer getScale()
           
 String[] getShardDatabase()
           
 String[] getShardTable()
           
 TableModel getTableModel()
           
 String getTail()
           
 Boolean getTransientable()
           
 Boolean getUpdatable()
           
 ColumnModel id()
          equal to pkey method.
 ColumnModel identityId()
          Mark a field will use database's native identity type.
 ColumnModel idGenerator(String idGeneratorName)
          The value of this column will be generated by a sequence or table generator
 ColumnModel insertable(Boolean insertable)
          Mark a field insertable=true, only for JPA or ORM tool use
 ColumnModel INTEGER()
           
 ColumnModel JAVA_OBJECT()
           
 ColumnModel LONG()
           
 ColumnModel LONGNVARCHAR(Integer length)
           
 ColumnModel LONGVARBINARY(Integer... lengths)
           
 ColumnModel LONGVARCHAR(Integer... lengths)
           
 ColumnModel NCHAR(Integer length)
           
 ColumnModel NCLOB()
           
 ColumnModel newCopy()
           
 ColumnModel notNull()
          Add a not null DDL piece if support
 ColumnModel NUMERIC(Integer... lengths)
           
 ColumnModel NVARCHAR(Integer length)
           
 ColumnModel OTHER(Integer... lengths)
           
 ColumnModel pkey()
          Mark primary key, if more than one will build compound Primary key
 ColumnModel REAL()
           
 ColumnModel sequenceGenerator(String name, String sequenceName, Integer initialValue, Integer allocationSize)
          The value of this column will be generated by a sequence
 void setCheck(String check)
           
 void setColumnName(String columnName)
           
 void setColumnType(Type columnType)
           
 void setComment(String comment)
           
 void setDefaultValue(String defaultValue)
           
 void setEntityField(String entityField)
           
 void setIdGenerationType(GenerationType idGenerationType)
           
 void setIdGeneratorName(String idGeneratorName)
           
 void setInsertable(Boolean insertable)
           
 void setLength(Integer length)
           
 void setLengths(Integer[] lengths)
           
 void setNullable(Boolean nullable)
           
 void setPkey(Boolean pkey)
           
 void setPrecision(Integer precision)
           
 void setScale(Integer scale)
           
 void setShardDatabase(String[] shardDatabase)
           
 void setShardTable(String[] shardTable)
           
 void setTableModel(TableModel tableModel)
           
 void setTail(String tail)
           
 void setTransientable(Boolean transientable)
           
 void setUpdatable(Boolean updatable)
           
 ColumnModel shardDatabase(String... shardDatabase)
          Mark is a shartDatabase column, for ORM tool use
 ColumnModel shardTable(String... shardTable)
          Mark is a shartTable column, for ORM tool use
 ColumnModel SHORT()
           
 FKeyModel singleFKey(String... refTableAndColumns)
          A shortcut method to add Foreign constraint for single column, for multiple columns please use tableModel.fkey() method instead
 ColumnModel singleIndex()
          A shortcut method to add a index for single column, for multiple columns index please use tableModel.index() method
 ColumnModel singleIndex(String indexName)
          A shortcut method to add a index for single column, for multiple columns index please use tableModel.index() method
 ColumnModel singleUnique()
          A shortcut method to add a unique constraint for single column, for multiple columns index please use tableModel.unique() method
 ColumnModel singleUnique(String uniqueName)
          A shortcut method to add a unique constraint for single column, for multiple columns index please use tableModel.unique() method
 ColumnModel SMALLINT()
           
 ColumnModel snowflake()
           
 ColumnModel sortedUUID(String name, Integer sortedLength, Integer uuidLength)
           
 ColumnModel STRING(Integer length)
           
 ColumnModel tableGenerator(String name, String tableName, String pkColumnName, String valueColumnName, String pkColumnValue, Integer initialValue, Integer allocationSize)
           
 ColumnModel tail(String tail)
          Put an extra tail String manually at the end of column definition DDL
 ColumnModel TIME()
           
 ColumnModel TIMESTAMP()
           
 ColumnModel timeStampId()
           
 ColumnModel TINYINT()
           
 ColumnModel updatable(Boolean updatable)
          Mark a field updatable=true, only for JPA or ORM tool use
 ColumnModel uuid25()
           
 ColumnModel uuid32()
           
 ColumnModel uuid36()
           
 ColumnModel uuidAny(String name, Integer length)
           
 ColumnModel VARBINARY(Integer... lengths)
           
 ColumnModel VARCHAR(Integer length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnModel

public ColumnModel(String columnName)
Method Detail

notNull

public ColumnModel notNull()
Add a not null DDL piece if support


check

public ColumnModel check(String check)
Add a column check DDL piece if support


newCopy

public ColumnModel newCopy()

singleIndex

public ColumnModel singleIndex(String indexName)
A shortcut method to add a index for single column, for multiple columns index please use tableModel.index() method


singleIndex

public ColumnModel singleIndex()
A shortcut method to add a index for single column, for multiple columns index please use tableModel.index() method


singleUnique

public ColumnModel singleUnique(String uniqueName)
A shortcut method to add a unique constraint for single column, for multiple columns index please use tableModel.unique() method


singleUnique

public ColumnModel singleUnique()
A shortcut method to add a unique constraint for single column, for multiple columns index please use tableModel.unique() method


defaultValue

public ColumnModel defaultValue(String value)
Default value for column's definition DDL


comment

public ColumnModel comment(String comment)
Add comments at end of column definition DDL


pkey

public ColumnModel pkey()
Mark primary key, if more than one will build compound Primary key


shardTable

public ColumnModel shardTable(String... shardTable)
Mark is a shartTable column, for ORM tool use


shardDatabase

public ColumnModel shardDatabase(String... shardDatabase)
Mark is a shartDatabase column, for ORM tool use


id

public ColumnModel id()
equal to pkey method. Mark primary key, if more than one will build compound Primary key


singleFKey

public FKeyModel singleFKey(String... refTableAndColumns)
A shortcut method to add Foreign constraint for single column, for multiple columns please use tableModel.fkey() method instead


getIdGenerator

public IdGenerator getIdGenerator()

identityId

public ColumnModel identityId()
Mark a field will use database's native identity type.


uuid25

public ColumnModel uuid25()

uuid32

public ColumnModel uuid32()

uuid36

public ColumnModel uuid36()

snowflake

public ColumnModel snowflake()

uuidAny

public ColumnModel uuidAny(String name,
                           Integer length)

timeStampId

public ColumnModel timeStampId()

autoId

public ColumnModel autoId()
Bind column to a global Auto Id generator, can be Sequence or a Table


sortedUUID

public ColumnModel sortedUUID(String name,
                              Integer sortedLength,
                              Integer uuidLength)

sequenceGenerator

public ColumnModel sequenceGenerator(String name,
                                     String sequenceName,
                                     Integer initialValue,
                                     Integer allocationSize)
The value of this column will be generated by a sequence


idGenerator

public ColumnModel idGenerator(String idGeneratorName)
The value of this column will be generated by a sequence or table generator


tableGenerator

public ColumnModel tableGenerator(String name,
                                  String tableName,
                                  String pkColumnName,
                                  String valueColumnName,
                                  String pkColumnValue,
                                  Integer initialValue,
                                  Integer allocationSize)

tail

public ColumnModel tail(String tail)
Put an extra tail String manually at the end of column definition DDL


entityField

public ColumnModel entityField(String entityFieldName)
Mark this column map to a Java entity field, if exist other columns map to this field, delete other columns. This method only designed for ORM tool


insertable

public ColumnModel insertable(Boolean insertable)
Mark a field insertable=true, only for JPA or ORM tool use


updatable

public ColumnModel updatable(Boolean updatable)
Mark a field updatable=true, only for JPA or ORM tool use


getDebugInfo

public String getDebugInfo()

checkReadOnly

public void checkReadOnly()

LONG

public ColumnModel LONG()

BOOLEAN

public ColumnModel BOOLEAN()

DOUBLE

public ColumnModel DOUBLE()

FLOAT

public ColumnModel FLOAT(Integer... lengths)

INTEGER

public ColumnModel INTEGER()

SHORT

public ColumnModel SHORT()

BIGDECIMAL

public ColumnModel BIGDECIMAL(Integer precision,
                              Integer scale)

STRING

public ColumnModel STRING(Integer length)

DATE

public ColumnModel DATE()

TIME

public ColumnModel TIME()

TIMESTAMP

public ColumnModel TIMESTAMP()

BIGINT

public ColumnModel BIGINT()

BINARY

public ColumnModel BINARY(Integer... lengths)

BIT

public ColumnModel BIT()

BLOB

public ColumnModel BLOB(Integer... lengths)

CHAR

public ColumnModel CHAR(Integer... lengths)

CLOB

public ColumnModel CLOB(Integer... lengths)

DECIMAL

public ColumnModel DECIMAL(Integer... lengths)

JAVA_OBJECT

public ColumnModel JAVA_OBJECT()

LONGNVARCHAR

public ColumnModel LONGNVARCHAR(Integer length)

LONGVARBINARY

public ColumnModel LONGVARBINARY(Integer... lengths)

LONGVARCHAR

public ColumnModel LONGVARCHAR(Integer... lengths)

NCHAR

public ColumnModel NCHAR(Integer length)

NCLOB

public ColumnModel NCLOB()

NUMERIC

public ColumnModel NUMERIC(Integer... lengths)

NVARCHAR

public ColumnModel NVARCHAR(Integer length)

OTHER

public ColumnModel OTHER(Integer... lengths)

REAL

public ColumnModel REAL()

SMALLINT

public ColumnModel SMALLINT()

TINYINT

public ColumnModel TINYINT()

VARBINARY

public ColumnModel VARBINARY(Integer... lengths)

VARCHAR

public ColumnModel VARCHAR(Integer length)

getColumnName

public String getColumnName()

setColumnName

public void setColumnName(String columnName)

getTableModel

public TableModel getTableModel()

setTableModel

public void setTableModel(TableModel tableModel)

getColumnType

public Type getColumnType()

setColumnType

public void setColumnType(Type columnType)

getPkey

public Boolean getPkey()

setPkey

public void setPkey(Boolean pkey)

getNullable

public Boolean getNullable()

setNullable

public void setNullable(Boolean nullable)

getCheck

public String getCheck()

setCheck

public void setCheck(String check)

getDefaultValue

public String getDefaultValue()

setDefaultValue

public void setDefaultValue(String defaultValue)

getIdGenerationType

public GenerationType getIdGenerationType()

setIdGenerationType

public void setIdGenerationType(GenerationType idGenerationType)

getIdGeneratorName

public String getIdGeneratorName()

setIdGeneratorName

public void setIdGeneratorName(String idGeneratorName)

getTail

public String getTail()

setTail

public void setTail(String tail)

getComment

public String getComment()

setComment

public void setComment(String comment)

getLengths

public Integer[] getLengths()

setLengths

public void setLengths(Integer[] lengths)

getEntityField

public String getEntityField()

setEntityField

public void setEntityField(String entityField)

getLength

public Integer getLength()

setLength

public void setLength(Integer length)

getPrecision

public Integer getPrecision()

setPrecision

public void setPrecision(Integer precision)

getScale

public Integer getScale()

setScale

public void setScale(Integer scale)

getInsertable

public Boolean getInsertable()

setInsertable

public void setInsertable(Boolean insertable)

getUpdatable

public Boolean getUpdatable()

setUpdatable

public void setUpdatable(Boolean updatable)

getTransientable

public Boolean getTransientable()

setTransientable

public void setTransientable(Boolean transientable)

getShardTable

public String[] getShardTable()

setShardTable

public void setShardTable(String[] shardTable)

getShardDatabase

public String[] getShardDatabase()

setShardDatabase

public void setShardDatabase(String[] shardDatabase)


Copyright © 2018. All rights reserved.