Class Column

java.lang.Object
org.litebridgedb.db.spi.Aliased
org.litebridgedb.db.spi.Column

public class Column extends Aliased
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 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(Table table, String name, @Nullable String alias)
      Construct a new Column instance associated with the specified table, column name, and optional column alias.
      Parameters:
      table - the table to which the column belongs; must not be null
      name - the name of the column; must not be null
      alias - an optional alias for the column; may be null if not needed
  • Method Details

    • table

      public Table table()
      Retrieve the Table instance associated with this Column.
      Returns:
      the Table to which this column belongs
    • as

      public Column as(String alias)
      Assign an alias to the current Column instance and return the updated instance.
      Overrides:
      as in class Aliased
      Parameters:
      alias - the alias to set for this column; must not be null
      Returns:
      the updated Column instance with the specified alias
    • c

      public static Column c(Table table, String column)
      Create a new Column instance for the specified table and column name.

      This is shorthand for new Column(table, column).

      Parameters:
      table - the table to which the column belongs
      column - the name of the column
      Returns:
      a new Column instance associated with the given table and column name
    • c

      public static Column c(String table, String column)
      Create a new Column instance associated with the specified table and column name.

      This is shorthand for new Column(new Table("", "", table), column).

      Parameters:
      table - the name of the table to which the column belongs
      column - the name of the column
      Returns:
      a new Column instance associated with the specified catalog, schema, table, and column name
    • c

      public static Column c(String schema, String table, String column)
      Create a new Column instance associated with the specified schema, table, and column name.

      This is shorthand for new Column(new Table("", schema, table), column).

      Parameters:
      schema - the name of the schema to which the table belongs
      table - the name of the table to which the column belongs
      column - the name of the column
      Returns:
      a new Column instance associated with the specified catalog, schema, table, and column name
    • c

      public static Column c(String catalog, String schema, String table, String column)
      Create a new Column instance associated with the specified catalog, schema, table, and column name.

      This is shorthand for new Column(new Table(catalog, schema, table), column).

      Parameters:
      catalog - the name of the catalog to which the table belongs
      schema - the name of the schema to which the table belongs
      table - the name of the table to which the column belongs
      column - the name of the column
      Returns:
      a new Column instance associated with the specified catalog, schema, table, and column name
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Aliased
    • equalsIgnoreAlias

      public boolean equalsIgnoreAlias(Aliased aliased)
      Overrides:
      equalsIgnoreAlias in class Aliased
    • equalsColumnOnlyIgnoreAlias

      public boolean equalsColumnOnlyIgnoreAlias(Column column)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Aliased
    • toString

      public String toString()
      Overrides:
      toString in class Object