org.codehaus.modello.generator.database.model

Class Table


public class Table
extends java.lang.Object

Models a table.
Version:
$Id: Table.java 149 2004-09-29 17:32:16Z jvanzyl $
Authors:
John Marshall/Connectria
Matthew Hawthorne

Constructor Summary

Table()

Method Summary

void
addAll(List columns)
void
addColumn(Column column)
void
addForeignKey(ForeignKey foreignKey)
void
addIndex(Index index)
void
addUnique(Unique index)
Add a unique index to this table
Column
findColumn(String name)
Finds the table with the specified name, using case insensitive matching.
Index
findIndex(String name)
Finds the index with the specified name, using case insensitive matching.
Column
getAutoIncrementColumn()
String
getCatalog()
Column
getColumn(int index)
List
getColumns()
ForeignKey
getForeignKey(int index)
List
getForeignKeys()
Index
getIndex(int index)
List
getIndexes()
String
getName()
List
getPrimaryKeyColumns()
String
getRemarks()
String
getSchema()
String
getType()
boolean
hasPrimaryKey()
void
setCatalog(String catalog)
void
setName(String name)
void
setRemarks(String remarks)
void
setSchema(String schema)
void
setType(String type)

Constructor Details

Table

public Table()

Method Details

addAll

public void addAll(List columns)

addColumn

public void addColumn(Column column)

addForeignKey

public void addForeignKey(ForeignKey foreignKey)

addIndex

public void addIndex(Index index)

addUnique

public void addUnique(Unique index)
Add a unique index to this table
Parameters:
index - The unique index

findColumn

public Column findColumn(String name)
Finds the table with the specified name, using case insensitive matching. Note that this method is not called getColumn(String) to avoid introspection problems.

findIndex

public Index findIndex(String name)
Finds the index with the specified name, using case insensitive matching. Note that this method is not called getIndex(String) to avoid introspection problems.

getAutoIncrementColumn

public Column getAutoIncrementColumn()
Returns:
the auto increment column, if there is one, otherwise null is returned

getCatalog

public String getCatalog()

getColumn

public Column getColumn(int index)

getColumns

public List getColumns()

getForeignKey

public ForeignKey getForeignKey(int index)

getForeignKeys

public List getForeignKeys()

getIndex

public Index getIndex(int index)

getIndexes

public List getIndexes()

getName

public String getName()

getPrimaryKeyColumns

public List getPrimaryKeyColumns()
Returns:
a List of primary key columns or an empty list if there are no primary key columns for this Table

getRemarks

public String getRemarks()

getSchema

public String getSchema()

getType

public String getType()

hasPrimaryKey

public boolean hasPrimaryKey()
Returns:
true if there is at least one primary key column on this table

setCatalog

public void setCatalog(String catalog)

setName

public void setName(String name)

setRemarks

public void setRemarks(String remarks)

setSchema

public void setSchema(String schema)

setType

public void setType(String type)