oracle.javatools.db
Class UniqueConstraint
java.lang.Object
oracle.javatools.db.AbstractDBObject
oracle.javatools.db.AbstractChildDBObject
oracle.javatools.db.Constraint
oracle.javatools.db.ColumnConstraint
oracle.javatools.db.UniqueConstraint
- All Implemented Interfaces:
- ChildDBObject, DBObject, Copyable, DynamicPropertySet
- Direct Known Subclasses:
- PKConstraint
public class UniqueConstraint
- extends ColumnConstraint
A UniqueConstraint
prohibits multiple rows from having the
same value in the same column or combination of columns but allows some
values to be null.
The list of columns constrained by the UniqueConstraint is stored by column
name.
Method Summary |
java.lang.String |
getConstraintType()
Retrieves the type of constraint represented by this instance. |
static boolean |
isUnique(Column col)
Returns true if the given table is constrained by a UniqueConstraint
(including PKConstraint) in its parent table. |
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 |
CONSTRAINT_TYPE
public static final java.lang.String CONSTRAINT_TYPE
- See Also:
- Constant Field Values
UniqueConstraint
public UniqueConstraint()
- Creates a new Constraint.
UniqueConstraint
public UniqueConstraint(java.lang.String name,
Relation relation)
- Creates a new Constraint of the specified name on the specified relation.
- Parameters:
name
- a string containing the name of the constraintrelation
- the Relation being constrained
getConstraintType
public java.lang.String getConstraintType()
- Description copied from class:
Constraint
- 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.
- Specified by:
getConstraintType
in class Constraint
- Returns:
- a string value indicating the type of constraint.
isUnique
public static boolean isUnique(Column col)
- Returns true if the given table is constrained by a UniqueConstraint
(including PKConstraint) in its parent table. This is just a convinience
wrapper around
ColumnConstraint.isConstrained(oracle.javatools.db.Column, java.lang.String...)
.
- Parameters:
col
- the column to test
- Returns:
- true if the column is uniquely constrained
Copyright © 1997, 2011, Oracle. All rights reserved.