Package io.debezium.relational
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 Summary
Fields Modifier and Type Field Description private String
columnName
private String
id
private static Pattern
IDENTIFIER_SEPARATOR_PATTERN
private TableId
tableId
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
catalog()
Get the name of the JDBC catalog.private static String
columnId(TableId tableId, String columnName)
String
columnName()
Get the name of the table.int
compareTo(ColumnId that)
int
compareToIgnoreCase(ColumnId that)
boolean
equals(Object obj)
static Map<TableId,Predicate<Column>>
filter(String columnExcludeList)
Create the map of predicate functions that specify which columns are to be included.int
hashCode()
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.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.String
schema()
Get the name of the JDBC schema.String
table()
Get the name of the table.TableId
tableId()
Get the identifier for the table that owns this column.String
toString()
-
-
-
Constructor Detail
-
ColumnId
public ColumnId(TableId tableId, String columnName)
Create a new column identifier.- Parameters:
tableId
- the identifier of the table; may not be nullcolumnName
- 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 tableschemaName
- the name of the database schema that contains the table; may be null if the JDBC driver does not show a schema for this tabletableName
- the name of the table; may not be nullcolumnName
- the name of the column; may not be null
-
-
Method Detail
-
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
intoColumnId
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 stringuseCatalogBeforeSchema
-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, orfalse
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 interfaceComparable<ColumnId>
-
compareToIgnoreCase
public int compareToIgnoreCase(ColumnId that)
-
-