Package io.debezium.relational
Class TableId
java.lang.Object
io.debezium.relational.TableId
- All Implemented Interfaces:
DataCollectionId
,Comparable<TableId>
@Immutable
public final class TableId
extends Object
implements DataCollectionId, Comparable<TableId>
Unique identifier for a database table.
- Author:
- Randall Hauch
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncatalog()
Get the name of the JDBC catalog.int
int
compareToIgnoreCase
(TableId that) boolean
int
hashCode()
static TableId
Parse the supplied string, extracting up to the first 3 parts into a TableID.protected static TableId
Parse the supplied string, extracting up to the first 3 parts into a TableID.static TableId
Parse the supplied string, extracting up to the first 3 parts into a TableID.static TableId
parse
(String str, boolean useCatalogBeforeSchema, TableIdPredicates predicates) Parse the supplied string, extracting up to the first 3 parts into a TableID.static TableId
parse
(String str, TableIdPredicates predicates) Parse the supplied string, extracting up to the first 3 parts into a TableID.static String[]
parseParts
(String str) Parse the supplied string into its tokenized parts.static String[]
parseParts
(String str, TableIdPredicates predicates) Parse the supplied string into its tokenized parts.parts()
private static String
Quotes the given identifier part, e.g.private static String
repeat
(char quotingChar) schema()
Get the name of the JDBC schema.table()
Get the name of the table.private static String
Returns a newTableId
with all parts of the identifier using"
character.Returns a dot-separated String representation of this identifier, quoting all name parts with the"
char.toQuoted
(char quotingChar) Returns a newTableId
that has all parts of the identifier quoted.toQuotedString
(char quotingChar) Returns a dot-separated String representation of this identifier, quoting all name parts with the given quoting char.toString()
-
Field Details
-
catalogName
-
schemaName
-
tableName
-
id
-
-
Constructor Details
-
TableId
public TableId(String catalogName, String schemaName, String tableName, Selectors.TableIdToStringMapper tableIdMapper) Create a new table 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 nulltableIdMapper
- the customization of fully quailified table name
-
TableId
Create a new table 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 null
-
-
Method Details
-
parse
Parse the supplied string, extracting up to the first 3 parts into a TableID.- Parameters:
str
- the string representation of the table identifier; may not be null- Returns:
- the table ID, or null if it could not be parsed
-
parse
Parse the supplied string, extracting up to the first 3 parts into a TableID.- Parameters:
str
- the string representation of the table identifier; may not be nullpredicates
- theTableIdPredicates
which determines DB specific reserved characters- Returns:
- the table ID, or null if it could not be parsed
-
parse
Parse the supplied string, extracting up to the first 3 parts into a TableID.- Parameters:
str
- the string representation of the table identifier; may not be nulluseCatalogBeforeSchema
-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 table ID, or null if it could not be parsed
-
parse
public static TableId parse(String str, boolean useCatalogBeforeSchema, TableIdPredicates predicates) Parse the supplied string, extracting up to the first 3 parts into a TableID.- Parameters:
str
- the string representation of the table identifier; may not be nulluseCatalogBeforeSchema
-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 namepredicates
- theTableIdPredicates
which determines DB specific reserved characters- Returns:
- the table ID, or null if it could not be parsed
-
parseParts
Parse the supplied string into its tokenized parts.- Parameters:
str
- the string representation of the table identifier; may not be null- Returns:
- the parts of the parsed string.
-
parseParts
Parse the supplied string into its tokenized parts.- Parameters:
str
- the string representation of the table identifier; may not be nullpredicates
- theTableIdPredicates
which determines DB specific reserved characters- Returns:
- the parts of the parsed string.
-
parse
Parse the supplied string, extracting up to the first 3 parts into a TableID.- Parameters:
parts
- the parts of the identifier; may not be nullnumParts
- the number of parts to use for the table identifieruseCatalogBeforeSchema
-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 table ID, or null if it could not be parsed
-
catalog
Get the name of the JDBC catalog.- Returns:
- the catalog name, or null if the table does not belong to a catalog
-
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
Get the name of the table.- Returns:
- the table name; never null
-
identifier
- Specified by:
identifier
in interfaceDataCollectionId
-
parts
- Specified by:
parts
in interfaceDataCollectionId
-
databaseParts
- Specified by:
databaseParts
in interfaceDataCollectionId
-
schemaParts
- Specified by:
schemaParts
in interfaceDataCollectionId
-
compareTo
- Specified by:
compareTo
in interfaceComparable<TableId>
-
compareToIgnoreCase
-
hashCode
public int hashCode() -
equals
-
toString
-
toDoubleQuotedString
Returns a dot-separated String representation of this identifier, quoting all name parts with the"
char. -
toDoubleQuoted
Returns a newTableId
with all parts of the identifier using"
character. -
toQuoted
Returns a newTableId
that has all parts of the identifier quoted.- Parameters:
quotingChar
- the character to be used to quote the identifier parts.
-
toQuotedString
Returns a dot-separated String representation of this identifier, quoting all name parts with the given quoting char. -
tableId
-
quote
Quotes the given identifier part, e.g. schema or table name. -
repeat
-
toLowercase
-