public class ConstraintClause extends SqlObject
[ CONSTRAINT <name> ] <type> [ (<col1> ...) ]
.Modifier and Type | Class and Description |
---|---|
static class |
ConstraintClause.CheckTime
Enum representing the different times that a constraint can be checked.
|
static class |
ConstraintClause.Type
Enum representing the types of constraints supported for a column or
table.
|
Modifier and Type | Field and Description |
---|---|
protected Object |
_checkTime |
protected SqlObjectList<SqlObject> |
_columns |
protected SqlObject |
_name |
protected ConstraintClause.Type |
_type |
ALL_SYMBOL, NULL_VALUE, QUESTION_MARK
Modifier | Constructor and Description |
---|---|
|
ConstraintClause(Constraint constraint) |
|
ConstraintClause(ConstraintClause.Type type,
Object name) |
protected |
ConstraintClause(ConstraintClause.Type type,
Object name,
List<?> columns) |
Modifier and Type | Method and Description |
---|---|
ConstraintClause |
addColumns(Column... columns)
Adds a column to the constraint definition.
|
ConstraintClause |
addCustomColumns(Object... columnStrs)
Adds a custom column to the constraint definition.
|
void |
appendTo(AppendableExt app)
Appends this object to the given AppendableExt.
|
static CheckConstraintClause |
checkCondition(Condition checkCondition)
Convenience method for generating an unnamed check constraint.
|
static CheckConstraintClause |
checkCondition(Object name,
Condition checkCondition)
Convenience method for generating a check constraint with the given name.
|
protected void |
collectSchemaObjects(ValidationContext vContext)
Used during Query.validate() calls to collect the dbschema objects
referenced in a query.
|
static ForeignKeyConstraintClause |
foreignKey(Object refTableStr)
Convenience method for generating an unnamed foreign key constraint.
|
static ForeignKeyConstraintClause |
foreignKey(Object name,
Object refTableStr)
Convenience method for generating a foreign key constraint with the given
name.
|
static ConstraintClause |
from(Constraint cons)
Returns the appropriately configured ConstraintClause (or
ForeignKeyConstraintClause) for the given Constraint.
|
static ConstraintClause |
notNull()
Convenience method for generating an unnamed not null constraint.
|
static ConstraintClause |
notNull(Object name)
Convenience method for generating a not null constraint with the given
name.
|
protected void |
postAppendTo(AppendableExt app) |
protected void |
preAppendTo(AppendableExt app) |
static ConstraintClause |
primaryKey()
Convenience method for generating an unnamed primary key constraint.
|
static ConstraintClause |
primaryKey(Object name)
Convenience method for generating a primary key constraint with the given
name.
|
ConstraintClause |
setCheckTime(Object checkTime)
Sets the check time for this constraint.
|
static ConstraintClause |
unique()
Convenience method for generating an unnamed unique constraint.
|
static ConstraintClause |
unique(Object name)
Convenience method for generating a unique constraint with the given
name.
|
collectSchemaObjects, doValidate, toString
toString, toString
protected final ConstraintClause.Type _type
protected final SqlObject _name
protected SqlObjectList<SqlObject> _columns
protected Object _checkTime
public ConstraintClause(Constraint constraint)
public ConstraintClause(ConstraintClause.Type type, Object name)
protected ConstraintClause(ConstraintClause.Type type, Object name, List<?> columns)
public ConstraintClause addColumns(Column... columns)
public ConstraintClause addCustomColumns(Object... columnStrs)
Object
-> SqlObject
conversions handled by
Converter.CUSTOM_COLUMN_TO_OBJ
.
public ConstraintClause setCheckTime(Object checkTime)
ConstraintClause.CheckTime
protected void collectSchemaObjects(ValidationContext vContext)
SqlObject
collectSchemaObjects
in class SqlObject
vContext
- handle to the current validation contextpublic void appendTo(AppendableExt app) throws IOException
Appendee
appendTo
in interface Appendee
appendTo
in class AppendeeObject
app
- the AppendableExt to which this class should append itselfIOException
- if the append failsprotected void preAppendTo(AppendableExt app) throws IOException
IOException
protected void postAppendTo(AppendableExt app) throws IOException
IOException
public static ConstraintClause from(Constraint cons)
public static ConstraintClause notNull()
public static ConstraintClause notNull(Object name)
name
- name of the constraint, may be null
public static ConstraintClause unique()
public static ConstraintClause unique(Object name)
name
- name of the constraint, may be null
public static ConstraintClause primaryKey()
public static ConstraintClause primaryKey(Object name)
name
- name of the constraint, may be null
public static ForeignKeyConstraintClause foreignKey(Object refTableStr)
public static ForeignKeyConstraintClause foreignKey(Object name, Object refTableStr)
name
- name of the constraint, may be null
refTableStr
- the table referenced by this constraintpublic static CheckConstraintClause checkCondition(Condition checkCondition)
public static CheckConstraintClause checkCondition(Object name, Condition checkCondition)
name
- name of the constraint, may be null
checkCondition
- the check conditionCopyright © 2006–2021 OpenHMS. All rights reserved.