Record Class ForeignKey

java.lang.Object
java.lang.Record
io.bloviate.db.ForeignKey
Record Components:
foreignKeyColumns - the columns that make up the foreign key
primaryKey - the primary key that this foreign key references

public record ForeignKey(List<KeyColumn> foreignKeyColumns, PrimaryKey primaryKey) extends Record
A foreign-key relationship: the columns of one table that reference the PrimaryKey of another.

This is the edge that drives the fill engine's topological ordering — the referenced (parent) table must be populated before the table that depends on it, so DatabaseFiller builds its dependency graph from these relationships. It also lets TableFiller seed a foreign-key column from its associated primary-key column so the generated values line up. Like a primary key, a foreign key may span several columns, paired in order with the primary-key columns they reference.

Since:
1.0.0
  • Constructor Details

    • ForeignKey

      public ForeignKey(List<KeyColumn> foreignKeyColumns, PrimaryKey primaryKey)
      Creates an instance of a ForeignKey record class.
      Parameters:
      foreignKeyColumns - the value for the foreignKeyColumns record component
      primaryKey - the value for the primaryKey record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • foreignKeyColumns

      public List<KeyColumn> foreignKeyColumns()
      Returns the value of the foreignKeyColumns record component.
      Returns:
      the value of the foreignKeyColumns record component
    • primaryKey

      public PrimaryKey primaryKey()
      Returns the value of the primaryKey record component.
      Returns:
      the value of the primaryKey record component