public class ForeignKey extends Object implements Serializable
| Constructor and Description |
|---|
ForeignKey()
Creates a new foreign key object that has no name.
|
ForeignKey(String name)
Creates a new foreign key object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addReference(Reference reference)
Adds a reference, ie.
|
boolean |
equals(Object obj) |
boolean |
equalsIgnoreCase(ForeignKey otherFk)
Compares this foreign key to the given one while ignoring the case of identifiers.
|
Reference |
getFirstReference()
Returns the first reference if it exists.
|
Table |
getForeignTable()
Returns the foreign table.
|
String |
getForeignTableName()
Returns the name of the foreign table.
|
String |
getName()
Returns the name of this foreign key.
|
CascadeActionEnum |
getOnDelete()
Returns the action for this foreignkey for when the referenced row is deleted.
|
CascadeActionEnum |
getOnUpdate()
Returns the action for this foreignkey for when the referenced row is changed.
|
Reference |
getReference(int idx)
Returns the indicated reference.
|
int |
getReferenceCount()
Returns the number of references.
|
Reference[] |
getReferences()
Returns the references.
|
boolean |
hasForeignColumn(Column column)
Determines whether this foreign key uses the given column as a foreign
column in a reference.
|
boolean |
hasForeignColumn(String columnName,
boolean caseSensitive)
Determines whether this foreign key uses the given column as a foreign
column in a reference.
|
int |
hashCode() |
boolean |
hasLocalColumn(Column column)
Determines whether this foreign key uses the given column as a local
column in a reference.
|
boolean |
hasLocalColumn(String columnName,
boolean caseSensitive)
Determines whether this foreign key uses the indicated column as a local
column in a reference.
|
boolean |
isAutoIndexPresent()
Determines whether this foreign key has an auto-generated associated index.
|
void |
removeReference(int idx)
Removes the indicated reference.
|
void |
removeReference(Reference reference)
Removes the given reference.
|
void |
setAutoIndexPresent(boolean autoIndexPresent)
Specifies whether this foreign key has an auto-generated associated index.
|
void |
setForeignTable(Table foreignTable)
Sets the foreign table.
|
void |
setForeignTableName(String foreignTableName)
Sets the name of the foreign table.
|
void |
setName(String name)
Sets the name of this foreign key.
|
void |
setOnDelete(CascadeActionEnum onDelete)
Sets the action for this foreignkey for when the referenced row is deleted.
|
void |
setOnUpdate(CascadeActionEnum onUpdate)
Sets the action for this foreignkey for when the referenced row is changed.
|
String |
toString() |
String |
toVerboseString()
Returns a verbose string representation of this foreign key.
|
public ForeignKey()
public ForeignKey(String name)
name - The name of the foreign keypublic String getName()
public void setName(String name)
name - The namepublic Table getForeignTable()
public void setForeignTable(Table foreignTable)
foreignTable - The foreign tablepublic String getForeignTableName()
public void setForeignTableName(String foreignTableName)
setForeignTable(Table) method.foreignTableName - The table namepublic CascadeActionEnum getOnDelete()
public void setOnDelete(CascadeActionEnum onDelete) throws NullPointerException
onDelete - The actionNullPointerException - If onDelete is nullpublic CascadeActionEnum getOnUpdate()
public void setOnUpdate(CascadeActionEnum onUpdate) throws NullPointerException
onUpdate - The actionNullPointerException - If onUdate is nullpublic int getReferenceCount()
public Reference getReference(int idx)
idx - The indexpublic Reference[] getReferences()
public Reference getFirstReference()
public void addReference(Reference reference)
reference - The reference to addpublic void removeReference(Reference reference)
reference - The reference to removepublic void removeReference(int idx)
idx - The index of the reference to removepublic boolean hasLocalColumn(Column column)
column - The column to checktrue if a reference uses the column as a local
columnpublic boolean hasLocalColumn(String columnName, boolean caseSensitive)
columnName - The name of the column to checkcaseSensitive - Whether case matters when checking for the column's nametrue if a reference uses the column as a local
columnpublic boolean hasForeignColumn(Column column)
column - The column to checktrue if a reference uses the column as a foreign
columnpublic boolean hasForeignColumn(String columnName, boolean caseSensitive)
columnName - The name of the column to checkcaseSensitive - Whether case matters when checking for the column's nametrue if a reference uses the column as a foreign
columnpublic boolean isAutoIndexPresent()
true if an auto-generated index existspublic void setAutoIndexPresent(boolean autoIndexPresent)
autoIndexPresent - true if an auto-generated index existspublic boolean equalsIgnoreCase(ForeignKey otherFk)
otherFk - The other foreign keytrue if this foreign key is equal (ignoring case) to the given onepublic String toVerboseString()
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.