Package com.exedio.cope
Class CheckConstraint
- java.lang.Object
-
- com.exedio.cope.Feature
-
- com.exedio.cope.CheckConstraint
-
- All Implemented Interfaces:
Copyable
,Serializable
public final class CheckConstraint extends Feature implements Copyable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CheckConstraint(Condition condition)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
check()
Checks, whether the database fulfills this check constraint.CheckConstraint
copy(CopyMapper mapper)
Condition
getCondition()
boolean
isSupportedBySchemaIfSupportedByDialect()
Return true iff this check constraint can be supported by a database dialect supporting check constraints.-
Methods inherited from class com.exedio.cope.Feature
afterModelCreated, getAbstractType, getAnnotation, getID, getLocalizationKeys, getName, getPattern, getType, isAnnotationPresent, isSourceAlready, mount, readResolve, requireMounted, toString, toString, writeReplace
-
-
-
-
Constructor Detail
-
CheckConstraint
public CheckConstraint(Condition condition)
-
-
Method Detail
-
copy
public CheckConstraint copy(CopyMapper mapper)
-
getCondition
public Condition getCondition()
-
isSupportedBySchemaIfSupportedByDialect
public boolean isSupportedBySchemaIfSupportedByDialect()
Return true iff this check constraint can be supported by a database dialect supporting check constraints. This is the case, iff all table columns mentioned bythe condition
if the check constraints are located within the same database table.The result of this method does not depend on
SchemaInfo.supportsCheckConstraints(Model)
.If returns false, you should call
check()
for checking database consistency after any modifications of the database bypassing cope.
-
check
public int check()
Checks, whether the database fulfills this check constraint. Should be called for checking database consistency after any modifications of the database bypassing cope. Is needed especially iffisSupportedBySchemaIfSupportedByDialect()
returns false.Returns the number of items violating the check constraint. As a consequence, this methods returns 0 (zero), iff the database fulfills this check constraint.
-
-