public abstract class Relation extends AbstractSchemaObject
Relation
represents the basic entity of a relational
database. Examples of relations include tables and views.
A Relation contains a list of Column
s and a list of
Constraint
s on the values for the columns in the Relation.
Column and Constraint instances are managed by Relation instances; making
a copy of a Relation implies making a copy of each Column and Constraint
contained within the Relation.
AbstractDBObject.ChildSupport, AbstractDBObject.ListenerSupport
Modifier | Constructor and Description |
---|---|
protected |
Relation()
Constructs a new Relation.
|
protected |
Relation(java.lang.String name,
Schema schema)
Constructs a new Relation with the specified name in the specified
schema.
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(Column col)
Adds one column to this relation.
|
void |
addColumn(int index,
Column col)
Adds one column to this relation at the given index.
|
void |
addConstraint(Constraint constraint)
Adds a Constraint to this relation.
|
Column |
getColumn(java.lang.String name)
Retrieves a column by name.
|
Column[] |
getColumns()
Retrieves the list of columns contained in this relation.
|
Constraint |
getConstraint(java.lang.String name)
Retrieves a constraint by name.
|
Constraint[] |
getConstraints()
Retrieves the list of constraints on this relation.
|
protected void |
getOwnedObjectsImpl(java.util.Collection<DBObject> c,
java.lang.String... types)
Implementation first checks that the object has been built - then returns
the collection from suprt.getOwnedObjectsImpl().
|
void |
removeColumn(Column col)
Removes a column from this relation.
|
void |
removeConstraint(Constraint constraint)
Removes a Constraint from this relation.
|
void |
setColumns(Column[] newCols)
Sets the entire list of columns, replacing any that have previously
been added.
|
void |
setConstraints(Constraint[] constraints)
Sets the list of constraints on this relation.
|
getSchema, setSchema
checkInit, checkInit, copyToImpl, getProperties, getReferenceIDsImpl, needsInitialization
addObjectListener, addObjectListener, addObjectListener, changeParent, compareToImpl, copyObject, copyTo, copyTo, copyTo, copyTo, equals, equalsImpl, findOwnedObject, findOwnedObject, findOwnedObject, findOwnedObject, findParent, fireObjectUpdated, firePropertyChanged, getChildSupport, getID, getName, getOwnedObjects, getOwnedObjects, getParent, getProperty, getProperty, getReferenceIDs, hashCode, includeOwnedObject, includesType, includesType, removeObjectListener, removeObjectListener, removeObjectListener, removeOwnedObject, removeThisAsParent, replaceReferenceIDs, setID, setName, setProperties, setProperty, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addObjectListener, removeObjectListener
addObjectListener, fireObjectUpdated, removeObjectListener
addObjectListener, copyTo, copyTo, copyTo, equals, findOwnedObject, findOwnedObject, findOwnedObject, getID, getName, getOwnedObjects, getOwnedObjects, getParent, getProperties, getReferenceIDs, getType, hashCode, removeObjectListener, removeOwnedObject, replaceReferenceIDs, setID, setName
getProperty, getProperty, setProperties, setProperty
protected Relation()
protected Relation(java.lang.String name, Schema schema)
name
- a string containing the name of the new relationschema
- the schema containing the new relationpublic void setColumns(Column[] newCols)
newCols
- an array containing the new list of columnspublic Column[] getColumns()
public void addColumn(Column col)
col
- the new column to addpublic void addColumn(int index, Column col)
index
- the index to add the new column atcol
- the new column to addpublic Column getColumn(java.lang.String name)
DBUtil.findChildByName(oracle.javatools.db.DBObject, java.lang.String, java.lang.String, oracle.javatools.db.DBObjectProvider)
instead.name
- string containing the desired column namenull
public void removeColumn(Column col)
col
- the column to removepublic Constraint[] getConstraints()
public void setConstraints(Constraint[] constraints)
constraints
- an array containing the list of constraintspublic Constraint getConstraint(java.lang.String name)
DBUtil.findChildByName(oracle.javatools.db.DBObject, java.lang.String, java.lang.String, oracle.javatools.db.DBObjectProvider)
instead.name
- string containing the desired constraint namenull
public void addConstraint(Constraint constraint)
constraint
- the constraint to addpublic void removeConstraint(Constraint constraint)
constraint
- the constraint to removeprotected void getOwnedObjectsImpl(java.util.Collection<DBObject> c, java.lang.String... types)
AbstractBuildableObject
getOwnedObjectsImpl
in class AbstractBuildableObject
c
- a Collection of the apppropriate children.types
- a vararg of the type(s) to search forAbstractDBObject.includesType(java.lang.String, java.lang.String...)