Package org.apache.torque.map

# Klasse TableMap

java.lang.Object
org.apache.torque.map.OptionSupport
org.apache.torque.map.TableMap

Alle implementierten Schnittstellen:
  `Serializable`

public class TableMap extends OptionSupport implements Serializable
TableMap is used to model a table in a database.

Version:
  $Id: TableMap.java 1917245 2024-04-21 14:06:23Z tv $
Autor:
  John D. McNally, Daniel Rall, Greg Monroe
Siehe auch:
  - Serialisierte Form

- ## Konstruktorübersicht

  Konstruktoren
  Konstruktor
  Beschreibung
  `TableMap(String tableName, String prefix, DatabaseMap containingDB)`
  Constructor.
  `TableMap(String tableName, DatabaseMap containingDB)`
  Constructor.

- ## Methodenübersicht

  Modifizierer und Typ
  Methode
  Beschreibung
  `void`
  `addColumn(ColumnMap cmap)`
  Add a pre-created column to this table.
  `void`
  `addForeignKey(ForeignKeyMap foreignKey)`
  Add a foreign key to this table.
  `boolean`
  `containsColumn(String name)`
  Does this table contain the specified column?
  `boolean`
  `containsColumn(ColumnMap column)`
  Does this table contain the specified column?
  `boolean`
  `containsObjectColumn()`
  Returns true if this tableMap contains a column with object data.
  `ColumnMap`
  `getColumn(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.
  `DatabaseMap`
  `getDbMap()`
  Returns the database map for this table.
  `String`
  `getDescription()`
  Returns the table description info.
  `List<ForeignKeyMap>`
  `getForeignKeys()`
  Get all foreign keys in the table..
  `String`
  `getFullyQualifiedTableName()`
  Returns the fully qualified table name, if available.
  `String`
  `getJavaName()`
  Get the Java name of the table as defined in XML.
  `Class<?>`
  `getManagerClass()`
  Returns the manager class for this table.
  `String`
  `getName()`
  Get the name of the Table, not prefixed by a possible schema name
  `Class<?>`
  `getOMClass()`
  Returns the OM class for this table.
  `Class<?>`
  `getPeerClass()`
  Returns the Peer Class for this table.
  `String`
  `getPrefix()`
  Get table prefix name.
  `ColumnMap`
  `getPrimaryKey()`
  Returns the single primary key of this table, if it exists
  `IDMethod`
  `getPrimaryKeyMethod()`
  Get the method used to generate primary keys for this table.
  `Object`
  `getPrimaryKeyMethodInfo(IDMethod idMethod)`
  Get the information used to generate a primary key
  `String`
  `getSchemaName()`
  Get the schema to which the table belongs to.
  `boolean`
  `isUseInheritance()`
  Returns whether this table uses inheritance.
  `boolean`
  `isUseManager()`
  Returns whether managers are used for this table.
  `final String`
  `removeUnderScores(String data)`
  Removes the PREFIX, removes the underscores and makes first letter caps.
  `void`
  `setDescription(String description)`
  Sets the table description.
  `void`
  `setJavaName(String value)`
  Set the Java name of the table as defined by generator/XML.
  `void`
  `setManagerClass(Class<?> managerClass)`
  Sets the manager class for this table.
  `void`
  `setOMClass(Class<?> omClass)`
  Sets the OM root class for this table.
  `void`
  `setPeerClass(Class<?> peerClass)`
  Sets the Peer class for this table.
  `void`
  `setPrefix(String prefix)`
  Set table prefix name.
  `void`
  `setPrimaryKeyMethod(IDMethod method)`
  Sets the method used to generate a key for this table.
  `void`
  `setPrimaryKeyMethodInfo(Object pkInfo)`
  Sets the pk information needed to generate a key.
  `void`
  `setPrimaryKeyMethodInfo(IDMethod idMethod, Object pkInfo)`
  Sets the pk information needed to generate a key.
  `void`
  `setUseInheritance(boolean useInheritance)`
  Sets whether this table uses inheritance.
  `void`
  `setUseManager(boolean useManager)`
  Sets whether managers are used for this table.
  `String`
  `toString()`

  ### Von Klasse geerbte Methoden org.apache.torque.map.OptionSupport

  `clearOptions, getOption, getOptions, setOption`

  ### Von Klasse geerbte Methoden java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Konstruktordetails

  - ### TableMap

    public TableMap(String tableName, DatabaseMap containingDB)
    Constructor.
    Parameter:
      `tableName` - The name of the table, may be prefixed with a schema name, not null.
      `containingDB` - A DatabaseMap that this table belongs to.

  - ### TableMap

    public TableMap(String tableName, String prefix, DatabaseMap containingDB)
    Constructor.
    Parameter:
      `tableName` - The name of the table, may be prefixed with a schema name, not null.
      `prefix` - The prefix for the table name (ie: SCARAB for SCARAB_PROJECT).
      `containingDB` - A DatabaseMap that this table belongs to.

- ## Methodendetails

  - ### containsColumn

    public boolean containsColumn(ColumnMap column)
    Does this table contain the specified column?
    Parameter:
      `column` - A ColumnMap.
    Gibt zurück:
      True if the table contains the column.

  - ### containsColumn

    public boolean containsColumn(String name)
    Does this table contain the specified column?
    Parameter:
      `name` - A String with the name of the column.
    Gibt zurück:
      True if the table contains the column.

  - ### getDatabaseMap

    public DatabaseMap getDatabaseMap()
    Get the DatabaseMap containing this TableMap.
    Gibt zurück:
      A DatabaseMap.

  - ### containsObjectColumn

    public boolean containsObjectColumn()
    Returns true if this tableMap contains a column with object data. If the type of the column is not a string, a number or a date, it is assumed that it is object data.
    Gibt zurück:
      True if map contains a column with object data.

  - ### getName

    public String getName()
    Get the name of the Table, not prefixed by a possible schema name
    Gibt zurück:
      A String with the name of the table, not null.

  - ### getSchemaName

    public String getSchemaName()
    Get the schema to which the table belongs to.
    Gibt zurück:
      the schema name, or null if the default schema should be used.

  - ### getFullyQualifiedTableName

    public String getFullyQualifiedTableName()
    Returns the fully qualified table name, if available.
    Gibt zurück:
      the fully qualified table name, if a schema is set, or just the table name if no schema is set, not null.

  - ### getJavaName

    public String getJavaName()
    Get the Java name of the table as defined in XML.
    Gibt zurück:
      A String with the Java name of the table.

  - ### setJavaName

    public void setJavaName(String value)
    Set the Java name of the table as defined by generator/XML.
    Parameter:
      `value` - A String with the Java name of the table.

  - ### getPrefix

    public String getPrefix()
    Get table prefix name.
    Gibt zurück:
      A String with the prefix.

  - ### setPrefix

    public void setPrefix(String prefix)
    Set table prefix name.
    Parameter:
      `prefix` - The prefix for the table name (ie: SCARAB for SCARAB_PROJECT).

  - ### getPrimaryKeyMethod

    public IDMethod getPrimaryKeyMethod()
    Get the method used to generate primary keys for this table.
    Gibt zurück:
      A String with the method.

  - ### getPrimaryKeyMethodInfo

    public Object getPrimaryKeyMethodInfo(IDMethod idMethod)
    Get the information used to generate a primary key
    Parameter:
      `idMethod` - `IDMethod` used to generate a primary key
    Gibt zurück:
      An Object.

  - ### getColumns

    public ColumnMap[] getColumns()
    Get a ColumnMap[] of the columns in this table.
    Gibt zurück:
      A ColumnMap[].

  - ### getForeignKeys

    public List<ForeignKeyMap> getForeignKeys()
    Get all foreign keys in the table..
    Gibt zurück:
      All foreign keys, not null.

  - ### getColumn

    public ColumnMap getColumn(String name)
    Get a ColumnMap for the named table.
    Parameter:
      `name` - A String with the name of the table.
    Gibt zurück:
      A ColumnMap.

  - ### addColumn

    public void addColumn(ColumnMap cmap)
    Add a pre-created column to this table. It will replace any existing column.
    Parameter:
      `cmap` - A ColumnMap.

  - ### addForeignKey

    public void addForeignKey(ForeignKeyMap foreignKey)
    Add a foreign key to this table.
    Parameter:
      `foreignKey` - the foreign key map, not null

  - ### setPrimaryKeyMethod

    public void setPrimaryKeyMethod(IDMethod method)
    Sets the method used to generate a key for this table. Valid values are as specified in the `IDMethod` interface.
    Parameter:
      `method` - The ID generation method type, not null.

  - ### setPrimaryKeyMethodInfo

    public void setPrimaryKeyMethodInfo(Object pkInfo)
    Sets the pk information needed to generate a key. This overrides all information set by `setPrimaryKeyMethodInfo(String, Object)`.
    Parameter:
      `pkInfo` - information needed to generate a key

  - ### setPrimaryKeyMethodInfo

    public void setPrimaryKeyMethodInfo(IDMethod idMethod, Object pkInfo)
    Sets the pk information needed to generate a key.
    Parameter:
      `idMethod` - the id method for which this information is stored.
      `pkInfo` - information needed to generate a key.

  - ### removeUnderScores

    public final String removeUnderScores(String data)
    Removes the PREFIX, removes the underscores and makes first letter caps. SCARAB_FOO_BAR becomes FooBar.
    Parameter:
      `data` - A String.
    Gibt zurück:
      A String with data processed.

  - ### getDescription

    public String getDescription()
    Returns the table description info.
    Gibt zurück:
      Returns the description.

  - ### setDescription

    public void setDescription(String description)
    Sets the table description.
    Parameter:
      `description` - The description to set.

  - ### getOMClass

    public Class<?> getOMClass()
    Returns the OM class for this table.
    Gibt zurück:
      the OM class.

  - ### setOMClass

    public void setOMClass(Class<?> omClass)
    Sets the OM root class for this table.
    Parameter:
      `omClass` - The OM root class for this table.

  - ### getPeerClass

    public Class<?> getPeerClass()
    Returns the Peer Class for this table.
    Gibt zurück:
      The peerClass for this table.

  - ### setPeerClass

    public void setPeerClass(Class<?> peerClass)
    Sets the Peer class for this table.
    Parameter:
      `peerClass` - The peerClass to set.

  - ### getDbMap

    public DatabaseMap getDbMap()
    Returns the database map for this table.
    Gibt zurück:
      the database map for this table.

  - ### isUseInheritance

    public boolean isUseInheritance()
    Returns whether this table uses inheritance.
    Gibt zurück:
      whether inheritance is used.

  - ### setUseInheritance

    public void setUseInheritance(boolean useInheritance)
    Sets whether this table uses inheritance.
    Parameter:
      `useInheritance` - whether this table uses inheritance.

  - ### isUseManager

    public boolean isUseManager()
    Returns whether managers are used for this table.
    Gibt zurück:
      whether managers are used for this table.

  - ### setUseManager

    public void setUseManager(boolean useManager)
    Sets whether managers are used for this table.
    Parameter:
      `useManager` - whether managers are used for this table.

  - ### getManagerClass

    public Class<?> getManagerClass()
    Returns the manager class for this table.
    Gibt zurück:
      the managerClass.

  - ### setManagerClass

    public void setManagerClass(Class<?> managerClass)
    Sets the manager class for this table.
    Parameter:
      `managerClass` - the manager class for this table.

  - ### getPrimaryKey

    public ColumnMap getPrimaryKey() throws TorqueException
    Returns the single primary key of this table, if it exists
    Gibt zurück:
      the single primary key column.
    Löst aus:
      `TorqueException` - If the table has no primary key or if the table has multiple primary keys.

  - ### toString

    public String toString()
    Setzt außer Kraft:
      `toString` in Klasse `Object`