Package org.datanucleus.store.rdbms.key
Class ForeignKey
- java.lang.Object
- 
- org.datanucleus.store.rdbms.key.ForeignKey
 
- 
 public class ForeignKey extends Object Representation of a foreign key to another table.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classForeignKey.FKActionEnum representing an action on the FK.
 - 
Constructor SummaryConstructors Constructor Description ForeignKey(DatastoreAdapter dba, boolean initiallyDeferred)Constructor.ForeignKey(JavaTypeMapping mapping, DatastoreAdapter dba, DatastoreClass refTable, boolean initiallyDeferred)Constructor.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddColumn(Column col)Class to add a column to the keyvoidaddColumn(Column col, Column refCol)Method to add a Column.protected voidassertSameDatastoreObject(Column col)Utility to assert if the column is for a different table.booleanequals(Object obj)Equality operator.StringgetColumnList()Accessor for the column liststatic StringgetColumnList(List<Column> cols)Method to return the list of columns which the key applies to.List<Column>getColumns()Accessor for the columns that the key relates to.StringgetName()Accessor for the key name.intgetNumberOfColumns()Accessor for the number of columns.StringgetRefColumnList()DatastoreClassgetRefTable()TablegetTable()Accessor for the tableinthashCode()Hashcode operator.booleanisEqual(ForeignKey fk)voidsetColumn(int seq, Column col)Sets a column in a specified positionseqfor this index.voidsetColumn(int seq, Column col, Column refCol)Set the column for the specified positionseqvoidsetDeleteAction(ForeignKey.FKAction deleteAction)Mutator for deleteAction.voidsetForMetaData(org.datanucleus.metadata.ForeignKeyMetaData fkmd)Convenience mutator for setting the specification based on MetaDataprotected static voidsetListMinimumSize(List list, int size)voidsetName(String name)Mutator for the key name.voidsetUpdateAction(ForeignKey.FKAction updateAction)Mutator for updateAction.StringtoString()Stringify method.
 
- 
- 
- 
Constructor Detail- 
ForeignKeypublic ForeignKey(DatastoreAdapter dba, boolean initiallyDeferred) Constructor.- Parameters:
- dba- Datastore adapter
- initiallyDeferred- Whether the constraints are deferred
 
 - 
ForeignKeypublic ForeignKey(JavaTypeMapping mapping, DatastoreAdapter dba, DatastoreClass refTable, boolean initiallyDeferred) Constructor.- Parameters:
- mapping- The type mapping for this Foreign-key field
- dba- Datastore adapter
- refTable- Referred to table
- initiallyDeferred- Whether they are deferred
 
 
- 
 - 
Method Detail- 
setForMetaDatapublic void setForMetaData(org.datanucleus.metadata.ForeignKeyMetaData fkmd) Convenience mutator for setting the specification based on MetaData- Parameters:
- fkmd- ForeignKey MetaData definition
 
 - 
setDeleteActionpublic void setDeleteAction(ForeignKey.FKAction deleteAction) Mutator for deleteAction.- Parameters:
- deleteAction- The deleteAction to set.
 
 - 
setUpdateActionpublic void setUpdateAction(ForeignKey.FKAction updateAction) Mutator for updateAction.- Parameters:
- updateAction- The updateAction to set.
 
 - 
addColumnpublic void addColumn(Column col, Column refCol) Method to add a Column.- Parameters:
- col- The column to add
- refCol- The column to reference
 
 - 
getRefTablepublic DatastoreClass getRefTable() 
 - 
getRefColumnListpublic String getRefColumnList() 
 - 
setColumnpublic void setColumn(int seq, Column col, Column refCol)Set the column for the specified positionseq- Parameters:
- seq- the specified position
- col- the column
- refCol- the foreign (refered) column
 
 - 
hashCodepublic int hashCode() Hashcode operator.- Returns:
- The hashcode
 
 - 
equalspublic boolean equals(Object obj) Equality operator.- Parameters:
- obj- Object to compare against
- Returns:
- Whether they are equal.
 
 - 
isEqualpublic boolean isEqual(ForeignKey fk) 
 - 
toStringpublic String toString() Stringify method. Generates the foreign key statement ready for use in an SQL call.
 - 
setNamepublic void setName(String name) Mutator for the key name.- Parameters:
- name- The key name
 
 - 
getNamepublic String getName() Accessor for the key name.- Returns:
- Key name
 
 - 
getTablepublic Table getTable() Accessor for the table- Returns:
- table
 
 - 
getColumnspublic List<Column> getColumns() Accessor for the columns that the key relates to.- Returns:
- the List of columns.
 
 - 
getColumnListpublic String getColumnList() Accessor for the column list- Returns:
- The column list
 
 - 
getNumberOfColumnspublic int getNumberOfColumns() Accessor for the number of columns.- Returns:
- The number of columns.
 
 - 
addColumnpublic void addColumn(Column col) Class to add a column to the key- Parameters:
- col- The column to add
 
 - 
setColumnpublic void setColumn(int seq, Column col)Sets a column in a specified positionseqfor this index.- Parameters:
- seq- the specified position for the- col
- col- the Column
 
 - 
assertSameDatastoreObjectprotected void assertSameDatastoreObject(Column col) Utility to assert if the column is for a different table.- Parameters:
- col- The column to compare with
 
 - 
setListMinimumSizeprotected static void setListMinimumSize(List list, int size) 
 
- 
 
-