public class ColumnDeclaration
extends java.lang.Object
This represents the declaration of a column, to be used as part of a TableDeclaration object.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
Constructor and Description |
---|
ColumnDeclaration(java.lang.String pName,
int pType)
Constructs a new ColumnDeclaration
|
ColumnDeclaration(java.lang.String pName,
int pType,
int pSize)
Constructs a new ColumnDeclaration
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAdditionalConstraints()
Returns any additional, possibly database-dependent constraints
for the column.
|
static java.lang.String |
getJDBCTypeName(int pType)
Returns the name of the JDBC type corresponding to the type
specified from java.sql.Types
|
java.lang.String |
getName()
Returns the name of the column
|
int |
getSize()
Returns the size of the column
|
int |
getType()
Returns the type of the column taken from java.sql.Types
|
boolean |
isNotNull()
Returns true if the NOT NULL constraint was added to the column.
|
boolean |
isNull()
Returns true if the NULL constraint was added to the column.
|
boolean |
isPrimaryKey()
Returns true if the PRIMARY KEY constraint was added to the column.
|
boolean |
isSizeDeclared()
Returns true is a size was declared for the column
|
boolean |
isUnique()
Returns true if the UNIQUE constraint was added to the column.
|
ColumnDeclaration |
withAdditionalConstraints(java.lang.String pAdditionalConstraints)
Adds any other additional constraints to the column that are
passed directly to the CREATE TABLE statement.
|
ColumnDeclaration |
withNotNull()
Adds the NOT NULL constraint to the column.
|
ColumnDeclaration |
withNull()
Adds the NULL constraint to the column.
|
ColumnDeclaration |
withPrimaryKey()
Adds the PRIMARY KEY constraint to the column.
|
ColumnDeclaration |
withSize(int pSize)
Sets the size of the column.
|
ColumnDeclaration |
withUnique()
Adds the UNIQUE constraint to the column.
|
public ColumnDeclaration(java.lang.String pName, int pType)
pName
- the name of the columnpType
- the SQL type as taken from java.sql.Typespublic ColumnDeclaration(java.lang.String pName, int pType, int pSize)
pName
- the name of the columnpType
- the SQL type as taken from java.sql.TypespSize
- the size of the column, for variable-length typespublic ColumnDeclaration withSize(int pSize)
public ColumnDeclaration withNull()
public ColumnDeclaration withNotNull()
public ColumnDeclaration withUnique()
public ColumnDeclaration withPrimaryKey()
public ColumnDeclaration withAdditionalConstraints(java.lang.String pAdditionalConstraints)
public java.lang.String getName()
public int getType()
public int getSize()
public boolean isSizeDeclared()
public boolean isNull()
public boolean isNotNull()
public boolean isUnique()
public boolean isPrimaryKey()
public java.lang.String getAdditionalConstraints()
public static java.lang.String getJDBCTypeName(int pType)