Record Class Key

Record Components:
primaryTableName - the name of the table containing the primary key
primaryColumnName - the name of the primary key column
foreignTableName - the name of the table containing the foreign key
foreignColumnName - the name of the foreign key column
sequence - the ordinal position of this column in a composite key (1-based)
name - the name of the foreign key constraint

public record Key(String primaryTableName, String primaryColumnName, String foreignTableName, String foreignColumnName, int sequence, String name) extends Record
One column-level link of a foreign-key relationship between two tables.

Each instance maps a single foreign-key column to the primary-key column it references, naming both tables and columns involved. For a composite foreign key the relationship is described by several Key rows that share a constraint name and are ordered by sequence; a simple key is just one such row. This is the flat, JDBC-metadata-shaped view from which the richer ForeignKey/KeyColumn structures are assembled.

Since:
1.0.0
  • Constructor Details

    • Key

      public Key(String primaryTableName, String primaryColumnName, String foreignTableName, String foreignColumnName, int sequence, String name)
      Creates an instance of a Key record class.
      Parameters:
      primaryTableName - the value for the primaryTableName record component
      primaryColumnName - the value for the primaryColumnName record component
      foreignTableName - the value for the foreignTableName record component
      foreignColumnName - the value for the foreignColumnName record component
      sequence - the value for the sequence record component
      name - the value for the name 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • primaryTableName

      public String primaryTableName()
      Returns the value of the primaryTableName record component.
      Returns:
      the value of the primaryTableName record component
    • primaryColumnName

      public String primaryColumnName()
      Returns the value of the primaryColumnName record component.
      Returns:
      the value of the primaryColumnName record component
    • foreignTableName

      public String foreignTableName()
      Returns the value of the foreignTableName record component.
      Returns:
      the value of the foreignTableName record component
    • foreignColumnName

      public String foreignColumnName()
      Returns the value of the foreignColumnName record component.
      Returns:
      the value of the foreignColumnName record component
    • sequence

      public int sequence()
      Returns the value of the sequence record component.
      Returns:
      the value of the sequence record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component