Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

oracle.javatools.db
Class UniqueConstraint

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


Nested Class Summary
 
Nested classes/interfaces inherited from class oracle.javatools.db.AbstractDBObject
AbstractDBObject.ChildSupport
 
Field Summary
static java.lang.String CONSTRAINT_TYPE
           
 
Fields inherited from class oracle.javatools.db.Constraint
TYPE
 
Fields inherited from interface oracle.javatools.db.DBObject
COMMENT
 
Constructor Summary
UniqueConstraint()
          Creates a new Constraint.
UniqueConstraint(java.lang.String name, Relation relation)
          Creates a new Constraint of the specified name on the specified relation.
 
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.ColumnConstraint
addColumn, getColumnIDs, getColumns, isConstrained, removeColumn, setColumnIDs, setColumns
 
Methods inherited from class oracle.javatools.db.Constraint
getConstraints, getRelation, getType, isEnabled, setEnabled, setRelation
 
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

CONSTRAINT_TYPE

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

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 constraint
relation - the Relation being constrained
Method Detail

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

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

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