- java.lang.Object
-
- org.tentackle.model.impl.ForeignKeyImpl
-
- All Implemented Interfaces:
java.lang.Comparable<ForeignKey>,ForeignKey
public class ForeignKeyImpl extends java.lang.Object implements ForeignKey, java.lang.Comparable<ForeignKey>
Implementation of a foreign key.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description ForeignKeyImpl(Entity referencingEntity, Attribute referencingAttribute, Entity referencedEntity, Attribute referencedAttribute, boolean composite)Creates a foreign key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(ForeignKey o)booleanequals(java.lang.Object obj)AttributegetReferencedAttribute()Gets the referenced attribute.EntitygetReferencedEntity()Gets the referenced entity.EntitygetReferencedTableProvidingEntity()Gets the entity that provides the table for the referenced entity.AttributegetReferencingAttribute()Gets the referencing attribute.EntitygetReferencingEntity()Gets the referencing entity.EntitygetReferencingTableProvidingEntity()Gets the entity that provides the table for the referencing entity.inthashCode()booleanisComposite()Returns whether the reference is via a composite relation.voidsetComposite(boolean composite)java.lang.StringsqlCreateForeignKey(org.tentackle.sql.Backend backend)Creates the foreign key creation sql code.java.lang.StringtoString()
-
-
-
Constructor Detail
-
ForeignKeyImpl
public ForeignKeyImpl(Entity referencingEntity, Attribute referencingAttribute, Entity referencedEntity, Attribute referencedAttribute, boolean composite)
Creates a foreign key.- Parameters:
referencingEntity- the referencing entityreferencingAttribute- the referenced entityreferencedEntity- the referenced entityreferencedAttribute- the referenced attributecomposite- true if cascade on delete and update
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
compareTo
public int compareTo(ForeignKey o)
- Specified by:
compareToin interfacejava.lang.Comparable<ForeignKey>
-
getReferencingEntity
public Entity getReferencingEntity()
Description copied from interface:ForeignKeyGets the referencing entity.- Specified by:
getReferencingEntityin interfaceForeignKey- Returns:
- the referencing entity
-
getReferencingAttribute
public Attribute getReferencingAttribute()
Description copied from interface:ForeignKeyGets the referencing attribute.- Specified by:
getReferencingAttributein interfaceForeignKey- Returns:
- the referencing attribute
-
getReferencedEntity
public Entity getReferencedEntity()
Description copied from interface:ForeignKeyGets the referenced entity.- Specified by:
getReferencedEntityin interfaceForeignKey- Returns:
- the referenced entity
-
getReferencedAttribute
public Attribute getReferencedAttribute()
Description copied from interface:ForeignKeyGets the referenced attribute.- Specified by:
getReferencedAttributein interfaceForeignKey- Returns:
- the referenced attribute
-
isComposite
public boolean isComposite()
Description copied from interface:ForeignKeyReturns whether the reference is via a composite relation.- Specified by:
isCompositein interfaceForeignKey- Returns:
- true if composite
-
setComposite
public void setComposite(boolean composite)
-
sqlCreateForeignKey
public java.lang.String sqlCreateForeignKey(org.tentackle.sql.Backend backend)
Description copied from interface:ForeignKeyCreates the foreign key creation sql code.- Specified by:
sqlCreateForeignKeyin interfaceForeignKey- Parameters:
backend- the backend to create sql code for- Returns:
- the SQL code
-
getReferencingTableProvidingEntity
public Entity getReferencingTableProvidingEntity()
Description copied from interface:ForeignKeyGets the entity that provides the table for the referencing entity.- Specified by:
getReferencingTableProvidingEntityin interfaceForeignKey- Returns:
- the entity, never null
-
getReferencedTableProvidingEntity
public Entity getReferencedTableProvidingEntity()
Description copied from interface:ForeignKeyGets the entity that provides the table for the referenced entity.- Specified by:
getReferencedTableProvidingEntityin interfaceForeignKey- Returns:
- the entity, never null
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-