Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.javatools.db
Class Constraint

java.lang.Object
  extended by oracle.javatools.db.AbstractDBObject
      extended by oracle.javatools.db.AbstractChildDBObject
          extended by 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.


Nested Class Summary
static class Constraint.DeferrableState
           
 
Nested classes/interfaces inherited from class oracle.javatools.db.AbstractDBObject
AbstractDBObject.ChildSupport, AbstractDBObject.ListenerSupport
 
Field Summary
static java.lang.String TYPE
           
 
Fields inherited from interface oracle.javatools.db.DBObject
COMMENT
 
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.
 Constraint.DeferrableState getDeferrableState()
          The deferrable state of the Constraint.
 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 setDeferrableState(Constraint.DeferrableState defer)
          Sets the deferrable state of this constraint.
 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.AbstractChildDBObject
copyToImpl, findParent, getParent, getProperty, setParent, setProperty
 
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
 
Methods inherited from interface oracle.javatools.util.DynamicPropertySet
getProperties, getProperty, setProperties
 

Field Detail

TYPE

public static final java.lang.String TYPE
See Also:
Constant Field Values
Constructor Detail

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
Method Detail

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.

setDeferrableState

public void setDeferrableState(Constraint.DeferrableState defer)
Sets the deferrable state of this constraint.

Parameters:
defer - the deferrable state for the constraint.

getDeferrableState

public Constraint.DeferrableState getDeferrableState()
The deferrable state of the Constraint.

Returns:
the deferrable state.

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()

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

Copyright © 1997, 2011, Oracle. All rights reserved.