|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.map.TableMap
TableMap is used to model a table in a database.
Field Summary | |
private java.util.Hashtable |
columns
The columns in the table. |
private DatabaseMap |
dbMap
The database this table belongs to. |
private java.lang.Object |
pkInfo
Object to store information that is needed if the for generating primary keys. |
private java.lang.String |
prefix
The prefix on the table name. |
private java.lang.String |
primaryKeyMethod
The primary key generation method. |
private java.lang.String |
tableName
The name of the table. |
protected static java.lang.String[] |
VALID_ID_METHODS
The list of valid ID generation methods. |
Fields inherited from interface org.apache.torque.adapter.IDMethod |
AUTO_INCREMENT, ID_BROKER, NATIVE, NO_ID_METHOD, SEQUENCE |
Constructor Summary | |
TableMap()
Required by proxy. |
|
TableMap(java.lang.String tableName,
DatabaseMap containingDB)
Constructor. |
|
TableMap(java.lang.String tableName,
int numberOfColumns,
DatabaseMap containingDB)
Constructor. |
|
TableMap(java.lang.String tableName,
java.lang.String prefix,
DatabaseMap containingDB)
Constructor. |
Method Summary | |
void |
addColumn(ColumnMap cmap)
Add a pre-created column to this table. |
void |
addColumn(java.lang.String columnName,
java.lang.Object type)
Add a column to this table of a certain type. |
private void |
addColumn(java.lang.String name,
java.lang.Object type,
boolean pk,
java.lang.String fkTable,
java.lang.String fkColumn,
int size)
Add a column to the table. |
void |
addColumn(java.lang.String columnName,
java.lang.Object type,
int size)
Add a column to this table of a certain type and size. |
void |
addForeignKey(java.lang.String columnName,
java.lang.Object type,
java.lang.String fkTable,
java.lang.String fkColumn)
Add a foreign key column to the table. |
void |
addForeignKey(java.lang.String columnName,
java.lang.Object type,
java.lang.String fkTable,
java.lang.String fkColumn,
int size)
Add a foreign key column to the table. |
void |
addForeignPrimaryKey(java.lang.String columnName,
java.lang.Object type,
java.lang.String fkTable,
java.lang.String fkColumn)
Add a foreign primary key column to the table. |
void |
addForeignPrimaryKey(java.lang.String columnName,
java.lang.Object type,
java.lang.String fkTable,
java.lang.String fkColumn,
int size)
Add a foreign primary key column to the table. |
void |
addPrimaryKey(java.lang.String columnName,
java.lang.Object type)
Add a primary key column to this Table. |
void |
addPrimaryKey(java.lang.String columnName,
java.lang.Object type,
int size)
Add a primary key column to this Table. |
boolean |
containsColumn(ColumnMap column)
Does this table contain the specified column? |
boolean |
containsColumn(java.lang.String name)
Does this table contain the specified column? |
boolean |
containsObjectColumn()
Returns true if this tableMap contains a column with object data. |
ColumnMap |
getColumn(java.lang.String name)
Get a ColumnMap for the named table. |
ColumnMap[] |
getColumns()
Get a ColumnMap[] of the columns in this table. |
DatabaseMap |
getDatabaseMap()
Get the DatabaseMap containing this TableMap. |
IdGenerator |
getIdGenerator()
Get the value of idGenerator. |
java.lang.String |
getName()
Get the name of the Table. |
java.lang.String |
getPrefix()
Get table prefix name. |
java.lang.String |
getPrimaryKeyMethod()
Get the method used to generate primary keys for this table. |
java.lang.Object |
getPrimaryKeyMethodInfo()
Get the information used to generate a primary key |
private boolean |
hasPrefix(java.lang.String data)
Tell me if i have PREFIX in my string. |
private java.lang.String |
removePrefix(java.lang.String data)
Removes the PREFIX. |
java.lang.String |
removeUnderScores(java.lang.String data)
Removes the PREFIX, removes the underscores and makes first letter caps. |
void |
setPrefix(java.lang.String prefix)
Set table prefix name. |
void |
setPrimaryKeyMethod(java.lang.String method)
Sets the method used to generate a key for this table. |
void |
setPrimaryKeyMethodInfo(java.lang.Object pkInfo)
Sets the pk information needed to generate a key |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String[] VALID_ID_METHODS
private java.util.Hashtable columns
private DatabaseMap dbMap
private java.lang.String tableName
private java.lang.String prefix
private java.lang.String primaryKeyMethod
private java.lang.Object pkInfo
Constructor Detail |
public TableMap()
public TableMap(java.lang.String tableName, int numberOfColumns, DatabaseMap containingDB)
tableName
- The name of the table.numberOfColumns
- The number of columns in the table.containingDB
- A DatabaseMap that this table belongs to.public TableMap(java.lang.String tableName, DatabaseMap containingDB)
tableName
- The name of the table.containingDB
- A DatabaseMap that this table belongs to.public TableMap(java.lang.String tableName, java.lang.String prefix, DatabaseMap containingDB)
tableName
- The name of the table.prefix
- The prefix for the table name (ie: SCARAB for
SCARAB_PROJECT).containingDB
- A DatabaseMap that this table belongs to.Method Detail |
public boolean containsColumn(ColumnMap column)
column
- A ColumnMap.
public boolean containsColumn(java.lang.String name)
name
- A String with the name of the column.
public DatabaseMap getDatabaseMap()
public boolean containsObjectColumn()
public java.lang.String getName()
public java.lang.String getPrefix()
public void setPrefix(java.lang.String prefix)
prefix
- The prefix for the table name (ie: SCARAB for
SCARAB_PROJECT).public java.lang.String getPrimaryKeyMethod()
public IdGenerator getIdGenerator()
public java.lang.Object getPrimaryKeyMethodInfo()
public ColumnMap[] getColumns()
public ColumnMap getColumn(java.lang.String name)
name
- A String with the name of the table.
public void addColumn(ColumnMap cmap)
cmap
- A ColumnMap.public void addColumn(java.lang.String columnName, java.lang.Object type)
columnName
- A String with the column name.type
- An Object specifying the type.public void addColumn(java.lang.String columnName, java.lang.Object type, int size)
columnName
- A String with the column name.type
- An Object specifying the type.size
- An int specifying the size.public void addPrimaryKey(java.lang.String columnName, java.lang.Object type)
columnName
- A String with the column name.type
- An Object specifying the type.public void addPrimaryKey(java.lang.String columnName, java.lang.Object type, int size)
columnName
- A String with the column name.type
- An Object specifying the type.size
- An int specifying the size.public void addForeignKey(java.lang.String columnName, java.lang.Object type, java.lang.String fkTable, java.lang.String fkColumn)
columnName
- A String with the column name.type
- An Object specifying the type.fkTable
- A String with the foreign key table name.fkColumn
- A String with the foreign key column name.public void addForeignKey(java.lang.String columnName, java.lang.Object type, java.lang.String fkTable, java.lang.String fkColumn, int size)
columnName
- A String with the column name.type
- An Object specifying the type.fkTable
- A String with the foreign key table name.fkColumn
- A String with the foreign key column name.size
- An int specifying the size.public void addForeignPrimaryKey(java.lang.String columnName, java.lang.Object type, java.lang.String fkTable, java.lang.String fkColumn)
columnName
- A String with the column name.type
- An Object specifying the type.fkTable
- A String with the foreign key table name.fkColumn
- A String with the foreign key column name.public void addForeignPrimaryKey(java.lang.String columnName, java.lang.Object type, java.lang.String fkTable, java.lang.String fkColumn, int size)
columnName
- A String with the column name.type
- An Object specifying the type.fkTable
- A String with the foreign key table name.fkColumn
- A String with the foreign key column name.size
- An int specifying the size.private void addColumn(java.lang.String name, java.lang.Object type, boolean pk, java.lang.String fkTable, java.lang.String fkColumn, int size)
name
- A String with the column name.type
- An Object specifying the type.pk
- True if column is a primary key.fkTable
- A String with the foreign key table name.fkColumn
- A String with the foreign key column name.size
- An int specifying the size.public void setPrimaryKeyMethod(java.lang.String method)
IDMethod
interface.
method
- The ID generation method type name.public void setPrimaryKeyMethodInfo(java.lang.Object pkInfo)
pkInfo
- information needed to generate a keyprivate final boolean hasPrefix(java.lang.String data)
data
- A String.
private final java.lang.String removePrefix(java.lang.String data)
data
- A String.
public final java.lang.String removeUnderScores(java.lang.String data)
data
- A String.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |