org.apache.torque.map
Class ForeignKeyMap

java.lang.Object
  extended by org.apache.torque.map.ForeignKeyMap
All Implemented Interfaces:
Serializable

public class ForeignKeyMap
extends Object
implements Serializable

ForeignKeyMap is used to model a foreign key in a database.

Version:
$Id: ForeignKeyMap.java 1448414 2013-02-20 21:06:35Z tfischer $
See Also:
Serialized Form

Nested Class Summary
static class ForeignKeyMap.ColumnPair
          A pair of local and Foreign column.
 
Constructor Summary
ForeignKeyMap(TableMap table, String foreignTableName)
          Constructor.
ForeignKeyMap(TableMap table, TableMap foreignTable)
          Constructor.
 
Method Summary
 void addColumns(ForeignKeyMap.ColumnPair columnPair)
          Adds a column pair to the foreign key.
 List<ForeignKeyMap.ColumnPair> getColumns()
          Returns the column pairs.
 TableMap getForeignTable()
          Returns the foreign table of the foreign key.
 String getForeignTableName()
          Returns name of the foreign table of the foreign key.
 TableMap getTable()
          Returns the local table of the foreign key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForeignKeyMap

public ForeignKeyMap(TableMap table,
                     TableMap foreignTable)
Constructor.

Parameters:
table - the local table, not null.
foreignTable - the foreign table, not null.
Throws:
NullPointerException - if an argument is null.

ForeignKeyMap

public ForeignKeyMap(TableMap table,
                     String foreignTableName)
Constructor.

Parameters:
table - the local table, not null.
foreignTableName - the name of the foreign table, not null.
Throws:
NullPointerException - if an argument is null.
Method Detail

addColumns

public void addColumns(ForeignKeyMap.ColumnPair columnPair)
Adds a column pair to the foreign key.

Parameters:
columnPair - the column pair to add, not null.

getTable

public TableMap getTable()
Returns the local table of the foreign key.

Returns:
the referencing table, not null.

getForeignTable

public TableMap getForeignTable()
Returns the foreign table of the foreign key.

Returns:
the referenced table, not null.
Throws:
IllegalStateException - if the foreign table map builder was not yet built.

getForeignTableName

public String getForeignTableName()
Returns name of the foreign table of the foreign key.

Returns:
the name of the referenced table, not null.

getColumns

public List<ForeignKeyMap.ColumnPair> getColumns()
Returns the column pairs.

Returns:
the column pairs, not null, as unmodifiable list.


Copyright © 2000-2013 The Apache Software Foundation. All Rights Reserved.