Package org.castor.ddlgen.schemaobject
Class Table
- java.lang.Object
-
- org.castor.ddlgen.schemaobject.AbstractSchemaObject
-
- org.castor.ddlgen.schemaobject.Table
-
- All Implemented Interfaces:
SchemaObject
- Direct Known Subclasses:
DefaultTable
,HsqlTable
,MysqlTable
public abstract class Table extends AbstractSchemaObject
Abstract base class of all table implementations.- Since:
- 1.1
- Version:
- $Revision: 5951 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
- Author:
- Le Duc Bao, Ralf Joachim
-
-
Field Summary
-
Fields inherited from class org.castor.ddlgen.schemaobject.AbstractSchemaObject
HASHFACTOR
-
-
Constructor Summary
Constructors Constructor Description Table()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addField(Field field)
Add given field to list of fields.void
addForeignKey(ForeignKey foreignKey)
Add given foreign key to list of foreign keys.void
addIndex(Index index)
Add given index to list of indices.boolean
equals(java.lang.Object other)
protected void
fields(DDLWriter writer)
Concatenate all fields names delimited by line separator.Field
getField(int index)
Get field at given index.Field
getField(java.lang.String name)
Get field with given name.int
getFieldCount()
Get number of fields.ForeignKey
getForeignKey(int index)
Get foreign key at given index.int
getForeignKeyCount()
Get number of foreign keys.Index
getIndex(int index)
Get index at given index.int
getIndexCount()
Get number of indices.KeyGenerator
getKeyGenerator()
Get key generator used for identities of this table.PrimaryKey
getPrimaryKey()
Get primary key with identities of this table.Schema
getSchema()
Get schema this table belongs to.int
hashCode()
void
merge(Table table)
Check if given table can be merged with this one.void
setKeyGenerator(KeyGenerator keyGenerator)
Set key generator used for identities of this table.void
setPrimaryKey(PrimaryKey primaryKey)
Set primary key with identities of this table.void
setSchema(Schema schema)
Set schema this table belongs to.-
Methods inherited from class org.castor.ddlgen.schemaobject.AbstractSchemaObject
equals, getConfiguration, getName, setConfiguration, setName
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.castor.ddlgen.schemaobject.SchemaObject
toCreateDDL, toDropDDL
-
-
-
-
Method Detail
-
addIndex
public final void addIndex(Index index)
Add given index to list of indices.- Parameters:
index
- Index to add to list of indices.
-
getIndexCount
public final int getIndexCount()
Get number of indices.- Returns:
- Number of indices.
-
getIndex
public final Index getIndex(int index)
Get index at given index.- Parameters:
index
- Index of index to return.- Returns:
- Index at given index.
-
addForeignKey
public final void addForeignKey(ForeignKey foreignKey)
Add given foreign key to list of foreign keys.- Parameters:
foreignKey
- Foreign key to add to list of foreign keys.
-
getForeignKeyCount
public final int getForeignKeyCount()
Get number of foreign keys.- Returns:
- Number of foreign keys.
-
getForeignKey
public final ForeignKey getForeignKey(int index)
Get foreign key at given index.- Parameters:
index
- Index of foreign key to return.- Returns:
- Foreign key at given index.
-
addField
public final void addField(Field field)
Add given field to list of fields.- Parameters:
field
- Field to add to list of fields.
-
getFieldCount
public final int getFieldCount()
Get number of fields.- Returns:
- Number of fields.
-
getField
public final Field getField(int index)
Get field at given index.- Parameters:
index
- Index of field to return.- Returns:
- Field at given index.
-
getField
public final Field getField(java.lang.String name)
Get field with given name.- Parameters:
name
- Name of field to return.- Returns:
- Field with given name.
-
setKeyGenerator
public final void setKeyGenerator(KeyGenerator keyGenerator)
Set key generator used for identities of this table.- Parameters:
keyGenerator
- Key generator used for identities of this table.
-
getKeyGenerator
public final KeyGenerator getKeyGenerator()
Get key generator used for identities of this table.- Returns:
- Key generator used for identities of this table.
-
setPrimaryKey
public final void setPrimaryKey(PrimaryKey primaryKey)
Set primary key with identities of this table.- Parameters:
primaryKey
- Primary key with identities of this table.
-
getPrimaryKey
public final PrimaryKey getPrimaryKey()
Get primary key with identities of this table.- Returns:
- Primary key with identities of this table.
-
setSchema
public final void setSchema(Schema schema)
Set schema this table belongs to.- Parameters:
schema
- Schema this table belongs to.
-
getSchema
public final Schema getSchema()
Get schema this table belongs to.- Returns:
- Schema this table belongs to.
-
fields
protected final void fields(DDLWriter writer) throws GeneratorException
Concatenate all fields names delimited by line separator.- Parameters:
writer
- DDLWriter to write schema objects to.- Throws:
GeneratorException
- If generation of the script failed or is not supported.
-
merge
public final void merge(Table table) throws GeneratorException
Check if given table can be merged with this one.- Parameters:
table
- Table to check if it is able to be merged.- Throws:
GeneratorException
- If tables cannot be merged.
-
equals
public final boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-