Skip navigation links
oracle.javatools.db
Class Constraint
java.lang.Object
oracle.javatools.db.AbstractDBObject
oracle.javatools.db.AbstractChildDBObject
oracle.javatools.db.Constraint
- All Implemented Interfaces:
- ChildDBObject, DBObject, Copyable, DynamicPropertySet
- Direct Known Subclasses:
- CheckConstraint, ColumnConstraint
-
public abstract class Constraint
- extends AbstractChildDBObject
A Constraint
represents a constraint on a table or view.
Field Summary |
static java.lang.String |
TYPE
|
Constructor Summary |
protected |
Constraint()
Constructs a new Constraint. |
protected |
Constraint(java.lang.String name, Relation relation)
Constructs a new Constraint on a relation with a specific name, and adds the constraint to the relation. |
Method Summary |
static java.util.Collection<Constraint> |
getConstraints(Relation rel, java.lang.String... types)
Lists the constraints on a given Relation that are of the given constraint types. |
abstract java.lang.String |
getConstraintType()
Retrieves the type of constraint represented by this instance. |
Relation |
getRelation()
Gets the Relation that owns this Constraint. |
java.lang.String |
getType()
Returns the type of this object. |
boolean |
isEnabled()
Whether this constraint is current enabled. |
void |
setEnabled(boolean enabled)
Sets the enabled state of this constraint. |
void |
setRelation(Relation relation)
Sets the Relation that owns this Constraint. |
Methods inherited from class oracle.javatools.db.AbstractDBObject |
changeParent, compareToImpl, copyObject, copyTo, copyTo, copyTo, copyTo, equals, equalsImpl, findOwnedObject, findOwnedObject, findOwnedObject, getChildSupport, getID, getName, getOwnedObjects, getOwnedObjects, getOwnedObjectsImpl, getProperties, getProperty, getReferenceIDs, getReferenceIDsImpl, hashCode, includeOwnedObject, includesType, includesType, removeThisAsParent, replaceReferenceIDs, setID, setName, setProperties, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface oracle.javatools.db.DBObject |
copyTo, copyTo, copyTo, findOwnedObject, findOwnedObject, getID, getName, getOwnedObjects, getOwnedObjects, getReferenceIDs, replaceReferenceIDs, setID, setName |
TYPE
public static final java.lang.String TYPE
-
- See Also:
- Constant Field Values
Constraint
protected Constraint()
- Constructs a new Constraint.
Constraint
protected Constraint(java.lang.String name,
Relation relation)
- Constructs a new Constraint on a relation with a specific name, and adds the constraint to the relation.
- Parameters:
name
- a string containing the constraint name
relation
- the relation being constrained
setEnabled
public void setEnabled(boolean enabled)
- Sets the enabled state of this constraint. Disabled constraints are not enforced.
-
- Parameters:
enabled
- a boolean value indicating whether this constraint it is enabled.
isEnabled
public boolean isEnabled()
- Whether this constraint is current enabled. Disabled constraints are not enforced.
-
- Returns:
- a boolean value indicating whether this constraint it is enabled.
getType
public java.lang.String getType()
- Description copied from interface:
DBObject
- Returns the type of this object. Valid types include things like tables, views, synonyms, and columns.
-
- Returns:
- a string describing the type of object.
getConstraintType
public abstract java.lang.String getConstraintType()
- Retrieves the type of constraint represented by this instance. Valid constraint types can vary depending on the database. Examples of constraint types include primary key constraints, foreign key constraints, and check constraints.
-
- Returns:
- a string value indicating the type of constraint.
getRelation
public Relation getRelation()
- Gets the
Relation
that owns this Constraint.
-
- Returns:
- the Relation that owns this constraint
setRelation
public void setRelation(Relation relation)
- Sets the
Relation
that owns this Constraint.
-
- Parameters:
relation
- the Relation that owns this constraint.
getConstraints
public static java.util.Collection<Constraint> getConstraints(Relation rel,
java.lang.String... types)
- Lists the constraints on a given Relation that are of the given constraint types.
-
- Parameters:
rel
- the relation to list the constraints from
types
- the types of constraint required
- Returns:
- a list of the constraints of given type
- See Also:
getConstraintType()
Skip navigation links
Copyright © 1997, 2015, Oracle. All rights reserved.