Class ColumnId

java.lang.Object
io.debezium.relational.ColumnId
All Implemented Interfaces:
Comparable<ColumnId>

@Immutable public final class ColumnId extends Object implements Comparable<ColumnId>
Unique identifier for a column in a database table.
Author:
Randall Hauch
  • Field Details

    • IDENTIFIER_SEPARATOR_PATTERN

      private static final Pattern IDENTIFIER_SEPARATOR_PATTERN
    • tableId

      private final TableId tableId
    • columnName

      private final String columnName
    • id

      private final String id
  • Constructor Details

    • ColumnId

      public ColumnId(TableId tableId, String columnName)
      Create a new column identifier.
      Parameters:
      tableId - the identifier of the table; may not be null
      columnName - the name of the column; may not be null
    • ColumnId

      public ColumnId(String catalogName, String schemaName, String tableName, String columnName)
      Create a new column identifier.
      Parameters:
      catalogName - the name of the database catalog that contains the table; may be null if the JDBC driver does not show a schema for this table
      schemaName - the name of the database schema that contains the table; may be null if the JDBC driver does not show a schema for this table
      tableName - the name of the table; may not be null
      columnName - the name of the column; may not be null
  • Method Details

    • filter

      public static Map<TableId,Predicate<Column>> filter(String columnExcludeList)
      Create the map of predicate functions that specify which columns are to be included.

      Qualified column names are comma-separated strings that are each parsed into ColumnId objects.

      Parameters:
      columnExcludeList - the comma-separated string listing the qualified names of the columns to be explicitly disallowed; may be null
      Returns:
      the predicate function; never null
    • parse

      public static ColumnId parse(String str)
      Parse the supplied string delimited with a period (.) character, extracting the last segment into a column name and the prior segments into the TableID.
      Parameters:
      str - the input string
      Returns:
      the column ID, or null if it could not be parsed
    • parse

      private static ColumnId parse(String str, boolean useCatalogBeforeSchema)
      Parse the supplied string delimited with the specified delimiter character, extracting the last segment into a column name and the prior segments into the TableID.
      Parameters:
      str - the input string
      useCatalogBeforeSchema - true if the parsed string contains only 2 items and the first should be used as the catalog and the second as the table name, or false if the first should be used as the schema and the second as the table name
      Returns:
      the column ID, or null if it could not be parsed
    • tableId

      public TableId tableId()
      Get the identifier for the table that owns this column.
      Returns:
      the table identifier; never null
    • catalog

      public String catalog()
      Get the name of the JDBC catalog.
      Returns:
      the catalog name, or null if the table does not belong to a catalog
    • schema

      public String schema()
      Get the name of the JDBC schema.
      Returns:
      the JDBC schema name, or null if the table does not belong to a JDBC schema
    • table

      public String table()
      Get the name of the table.
      Returns:
      the table name; never null
    • columnName

      public String columnName()
      Get the name of the table.
      Returns:
      the table name; never null
    • compareTo

      public int compareTo(ColumnId that)
      Specified by:
      compareTo in interface Comparable<ColumnId>
    • compareToIgnoreCase

      public int compareToIgnoreCase(ColumnId that)
    • hashCode

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

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

      public String toString()
      Overrides:
      toString in class Object
    • columnId

      private static String columnId(TableId tableId, String columnName)