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 |
DBObject |
copyTo(DBObject target,
DBObject copyParent,
IDPolicy idPolicy)
Internal copy method used by the API to perform copy operations. |
boolean |
equals(java.lang.Object target)
|
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.ColumnConstraint |
addColumn, copyToImpl, equalsImpl, getColumnIDs, getColumns, getReferenceIDsImpl, isConstrained, removeColumn, replaceReferenceIDs, setColumnIDs, setColumns |
Methods inherited from class oracle.javatools.db.AbstractDBObject |
changeParent, compareToImpl, copyObject, copyTo, copyTo, copyTo, copyToImpl, equalsImpl, findOwnedObject, findOwnedObject, findOwnedObject, getChildSupport, getID, getName, getOwnedObjects, getOwnedObjects, getOwnedObjectsImpl, getProperties, getProperty, getProperty, getReferenceIDs, hashCode, includeOwnedObject, includesType, includesType, removeThisAsParent, setID, setName, setProperties, setProperty, 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, 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
copyTo
public DBObject copyTo(DBObject target,
DBObject copyParent,
IDPolicy idPolicy)
- Description copied from class:
AbstractDBObject
- Internal copy method used by the API to perform copy operations. All
objects must implement this method if they are instantiable objects.
Abstract objects (e.g. Relation) must NOT implement this method. The
implementation should delegate to the copyToImpl method to copy
the actual properties.
This method does not fix internal reference ids on copy. That is done by
the calling DBObject.copyTo(DBObject, IDPolicy)
method.
- Specified by:
copyTo
in class AbstractDBObject
- See Also:
DBObject.copyTo(java.lang.Object)
,
DBObject.copyTo(DBObject, boolean)
,
AbstractDBObject.copyToImpl(oracle.javatools.db.AbstractDBObject, oracle.javatools.db.DBObject, oracle.javatools.db.IDPolicy)
equals
public boolean equals(java.lang.Object target)
- Overrides:
equals
in class java.lang.Object
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, 2009, Oracle. All rights reserved.