Class ForeignKeyImpl

java.lang.Object
org.tentackle.model.impl.ForeignKeyImpl
All Implemented Interfaces:
Comparable<ForeignKey>, ForeignKey

public class ForeignKeyImpl extends Object implements ForeignKey, Comparable<ForeignKey>
Implementation of a foreign key.
Author:
harald
  • Constructor Details

    • ForeignKeyImpl

      public ForeignKeyImpl(Entity referencingEntity, Attribute referencingAttribute, Entity referencedEntity, Attribute referencedAttribute, boolean composite)
      Creates a foreign key.
      Parameters:
      referencingEntity - the referencing entity
      referencingAttribute - the referenced entity
      referencedEntity - the referenced entity
      referencedAttribute - the referenced attribute
      composite - true if cascade on delete and update
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(ForeignKey o)
      Specified by:
      compareTo in interface Comparable<ForeignKey>
    • getReferencingEntity

      public Entity getReferencingEntity()
      Description copied from interface: ForeignKey
      Gets the referencing entity.
      Specified by:
      getReferencingEntity in interface ForeignKey
      Returns:
      the referencing entity
    • getReferencingAttribute

      public Attribute getReferencingAttribute()
      Description copied from interface: ForeignKey
      Gets the referencing attribute.
      Specified by:
      getReferencingAttribute in interface ForeignKey
      Returns:
      the referencing attribute
    • getReferencedEntity

      public Entity getReferencedEntity()
      Description copied from interface: ForeignKey
      Gets the referenced entity.
      Specified by:
      getReferencedEntity in interface ForeignKey
      Returns:
      the referenced entity
    • getReferencedAttribute

      public Attribute getReferencedAttribute()
      Description copied from interface: ForeignKey
      Gets the referenced attribute.
      Specified by:
      getReferencedAttribute in interface ForeignKey
      Returns:
      the referenced attribute
    • isComposite

      public boolean isComposite()
      Description copied from interface: ForeignKey
      Returns whether the reference is via a composite relation.
      Specified by:
      isComposite in interface ForeignKey
      Returns:
      true if composite
    • setComposite

      public void setComposite(boolean composite)
    • sqlCreateForeignKey

      public String sqlCreateForeignKey(Backend backend)
      Description copied from interface: ForeignKey
      Creates the foreign key creation sql code.
      Specified by:
      sqlCreateForeignKey in interface ForeignKey
      Parameters:
      backend - the backend to create sql code for
      Returns:
      the SQL code
    • getReferencingTableProvidingEntity

      public Entity getReferencingTableProvidingEntity()
      Description copied from interface: ForeignKey
      Gets the entity that provides the table for the referencing entity.
      Specified by:
      getReferencingTableProvidingEntity in interface ForeignKey
      Returns:
      the entity, never null
    • getReferencedTableProvidingEntity

      public Entity getReferencedTableProvidingEntity()
      Description copied from interface: ForeignKey
      Gets the entity that provides the table for the referenced entity.
      Specified by:
      getReferencedTableProvidingEntity in interface ForeignKey
      Returns:
      the entity, never null
    • toString

      public String toString()
      Overrides:
      toString in class Object