com.jgpruitt.datamodeler.core
Class Table

java.lang.Object
  extended by com.jgpruitt.datamodeler.core.ColumnSet
      extended by com.jgpruitt.datamodeler.core.Table
All Implemented Interfaces:
java.lang.Iterable<Column>

public class Table
extends ColumnSet

This class models a database Table

Author:
John Pruitt

Field Summary
protected  java.lang.String comment
           
protected  ForeignKeySet fkConstraints
           
protected  ForeignKeySet fkReferences
           
protected  IndexSet ixs
           
protected  java.lang.String name
           
protected  PrimaryKey pk
           
protected  Schema schema
           
protected  UniqueKeySet uks
           
 
Fields inherited from class com.jgpruitt.datamodeler.core.ColumnSet
list, map
 
Constructor Summary
Table(java.lang.String name)
          Constructor.
 
Method Summary
 Column add(Column col)
          Adds a Column to the Table
 java.lang.String getComment()
          Gets the comment describing this Table
 ForeignKeySet getForeignKeyConstraints()
          Gets the set of ForeignKey constraints on the Table
 ForeignKeySet getForeignKeyReferences()
          Gets the set of ForeignKey constraints that reference this Table
 IndexSet getIndexes()
          Gets the set of Indexes on this Table
 java.lang.String getName()
          Gets the name of the Table
 PrimaryKey getPrimaryKey()
          Gets the Table's PrimaryKey constraint or null
 Schema getSchema()
          Gets the Schema to which this Table belongs
 UniqueKeySet getUniqueKeys()
          Gets the set of UniqueKey constraints on the Table
 void setComment(java.lang.String comment)
          Sets the comment describing the Table
 void setPrimaryKey(PrimaryKey pk)
          Sets the PrimaryKey constraint for the Table
 void setSchema(Schema schema)
          Sets the Schema to which this Table belongs
 
Methods inherited from class com.jgpruitt.datamodeler.core.ColumnSet
contains, contains, get, get, isEmpty, iterator, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected final java.lang.String name

schema

protected Schema schema

pk

protected PrimaryKey pk

uks

protected final UniqueKeySet uks

ixs

protected final IndexSet ixs

fkConstraints

protected final ForeignKeySet fkConstraints

fkReferences

protected final ForeignKeySet fkReferences

comment

protected java.lang.String comment
Constructor Detail

Table

public Table(java.lang.String name)
Constructor.

Parameters:
name - The name of the Table
Method Detail

getName

public java.lang.String getName()
Gets the name of the Table

Returns:
the table name

getSchema

public Schema getSchema()
Gets the Schema to which this Table belongs

Returns:
the Schema

setSchema

public void setSchema(Schema schema)
Sets the Schema to which this Table belongs

Parameters:
schema - the Schema

add

public Column add(Column col)
Adds a Column to the Table

Overrides:
add in class ColumnSet
Parameters:
col - The Column to add to the set.
Returns:
the Column that was added
See Also:
Column

getPrimaryKey

public PrimaryKey getPrimaryKey()
Gets the Table's PrimaryKey constraint or null

Returns:
the PrimaryKey or null

setPrimaryKey

public void setPrimaryKey(PrimaryKey pk)
Sets the PrimaryKey constraint for the Table

Parameters:
pk - the PrimaryKey constraint

getUniqueKeys

public UniqueKeySet getUniqueKeys()
Gets the set of UniqueKey constraints on the Table

Returns:
the UniqueKeySet

getForeignKeyConstraints

public ForeignKeySet getForeignKeyConstraints()
Gets the set of ForeignKey constraints on the Table

Returns:
the ForeignKeySet

getForeignKeyReferences

public ForeignKeySet getForeignKeyReferences()
Gets the set of ForeignKey constraints that reference this Table

Returns:
the ForeignKeySet

getIndexes

public IndexSet getIndexes()
Gets the set of Indexes on this Table

Returns:
the IndexSet

getComment

public java.lang.String getComment()
Gets the comment describing this Table

Returns:
the comment

setComment

public void setComment(java.lang.String comment)
Sets the comment describing the Table

Parameters:
comment - the comment