public class ForeignKey extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ForeignKey.FKAction
Enum representing an action on the FK.
|
Modifier and Type | Field and Description |
---|---|
protected List<Column> |
columns
Columns that the key relates to.
|
protected String |
name
Name of the key.
|
protected Table |
table
Table that the key applies to.
|
Constructor and Description |
---|
ForeignKey(boolean initiallyDeferred)
Constructor.
|
ForeignKey(JavaTypeMapping mapping,
DatastoreAdapter dba,
DatastoreClass refTable,
boolean initiallyDeferred)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(Column col)
Class to add a column to the key
|
void |
addColumn(Column col,
Column refCol)
Method to add a Column.
|
protected void |
assertSameDatastoreObject(Column col)
Utility to assert if the column is for a different table.
|
boolean |
equals(Object obj)
Equality operator.
|
String |
getColumnList()
Accessor for the column list
|
static String |
getColumnList(Collection 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.
|
String |
getName()
Accessor for the key name.
|
String |
getRefColumnList() |
DatastoreClass |
getRefTable() |
Table |
getTable()
Accessor for the table
|
int |
hashCode()
Hashcode operator.
|
boolean |
isEqual(ForeignKey fk) |
void |
setColumn(int seq,
Column col,
Column refCol)
Set the datastore field for the specified position
seq |
void |
setDeleteAction(ForeignKey.FKAction deleteAction)
Mutator for deleteAction.
|
void |
setForMetaData(org.datanucleus.metadata.ForeignKeyMetaData fkmd)
Convenience mutator for setting the specification based on MetaData
|
protected static void |
setMinSize(List list,
int size) |
void |
setName(String name)
Mutator for the key name.
|
void |
setUpdateAction(ForeignKey.FKAction updateAction)
Mutator for updateAction.
|
boolean |
startsWith(org.datanucleus.store.rdbms.key.Key key)
Check if this starts with the same columns specified in
key . |
String |
toString()
Stringify method.
|
protected String name
protected Table table
public ForeignKey(boolean initiallyDeferred)
initiallyDeferred
- Whether the constraints are deferredpublic ForeignKey(JavaTypeMapping mapping, DatastoreAdapter dba, DatastoreClass refTable, boolean initiallyDeferred)
mapping
- The type mapping for this Foreign-key fielddba
- Datastore adapterrefTable
- Referred to tableinitiallyDeferred
- Whether they are deferredpublic void setForMetaData(org.datanucleus.metadata.ForeignKeyMetaData fkmd)
fkmd
- ForeignKey MetaData definitionpublic void setDeleteAction(ForeignKey.FKAction deleteAction)
deleteAction
- The deleteAction to set.public void setUpdateAction(ForeignKey.FKAction updateAction)
updateAction
- The updateAction to set.public void addColumn(Column col, Column refCol)
col
- The column to addrefCol
- The column to referencepublic DatastoreClass getRefTable()
public String getRefColumnList()
public void setColumn(int seq, Column col, Column refCol)
seq
seq
- the specified positioncol
- the datastore fieldrefCol
- the foreign (refered) datastore fieldpublic int hashCode()
public boolean equals(Object obj)
obj
- Object to compare againstpublic boolean isEqual(ForeignKey fk)
public String toString()
public String getName()
public Table getTable()
public List<Column> getColumns()
public String getColumnList()
public void addColumn(Column col)
col
- The column to addpublic boolean startsWith(org.datanucleus.store.rdbms.key.Key key)
key
.key
- the Key (may be multiple number of columns)key
public void setName(String name)
name
- The key nameprotected void assertSameDatastoreObject(Column col)
col
- The column to compare withprotected static void setMinSize(List list, int size)
public static String getColumnList(Collection cols)
cols
- The columns.Copyright © 2017. All rights reserved.