Record Class Column

java.lang.Object
java.lang.Record
org.litebridge.db.spi.Column
Record Components:
name - Name of the database column.
table - Table to which this column belongs.

public record Column(String name, Table table) extends Record
A database column that belongs to a specific table and optionally has an alias.

It extends the functionality of the Aliased class to include the concept of table association. Columns can be used to construct queries and represent database metadata.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Column(String name)
    Construct a new Column instance without an associated Table instance.
    Column(String name, Table table)
    Creates an instance of a Column record class.
    Column(Table table, String name)
    Construct a new Column instance associated with the specified table and column name.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
     
    Returns the value of the name record component.
    Returns the qualified name of the column ("tableName.columnName").
    Returns the value of the table record component.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Column

      public Column(Table table, String name)
      Construct a new Column instance associated with the specified table and column name.
      Parameters:
      table - the table to which the column belongs; must not be null
      name - the name of the column; must not be null
    • Column

      public Column(String name)
      Construct a new Column instance without an associated Table instance.
      Parameters:
      name - the name of the column; must not be null
    • Column

      public Column(String name, Table table)
      Creates an instance of a Column record class.
      Parameters:
      name - the value for the name record component
      table - the value for the table record component
  • Method Details

    • hasTable

      public boolean hasTable()
    • qualifiedName

      public String qualifiedName()
      Returns the qualified name of the column ("tableName.columnName").
      Returns:
      the qualified column name
    • toString

      public 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.
    • name

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

      public Table table()
      Returns the value of the table record component.
      Returns:
      the value of the table record component