Package io.debezium.connector.mongodb
Class CollectionId
- java.lang.Object
-
- io.debezium.connector.mongodb.CollectionId
-
- All Implemented Interfaces:
DataCollectionId
@Immutable public final class CollectionId extends Object implements DataCollectionId
A simple identifier for collections in a replica set.- Author:
- Randall Hauch
-
-
Constructor Summary
Constructors Constructor Description CollectionId(String replicaSetName, String dbName, String collectionName)Create a new collection identifier.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringdbName()Get the name of the database in which the collection exists.booleanequals(Object obj)inthashCode()Stringidentifier()Stringname()Get the name of the collection.Stringnamespace()Get the namespace of this collection, which is comprised of thedatabase nameandcollection name.static CollectionIdparse(String replicaSetName, String str)Parse the supplied<database_name>.<collection_name>string.StringreplicaSetName()Get the name of the replica set in which the collection (and database) exist.StringtoString()
-
-
-
Constructor Detail
-
CollectionId
public CollectionId(String replicaSetName, String dbName, String collectionName)
Create a new collection identifier.- Parameters:
replicaSetName- the name of the replica set; may not be nulldbName- the name of the database; may not be nullcollectionName- the name of the collection; may not be null
-
-
Method Detail
-
parse
public static CollectionId parse(String replicaSetName, String str)
Parse the supplied<database_name>.<collection_name>string. Thecollection_namecan also contain dots in its value.- Parameters:
replicaSetName- the name of replica; may not be nullstr- the string representation of the collection identifier; may not be null- Returns:
- the collection ID, or null if it could not be parsed
-
name
public String name()
Get the name of the collection.- Returns:
- the collection's name; never null
-
dbName
public String dbName()
Get the name of the database in which the collection exists.- Returns:
- the database name; never null
-
replicaSetName
public String replicaSetName()
Get the name of the replica set in which the collection (and database) exist.- Returns:
- the replica set name; never null
-
identifier
public String identifier()
- Specified by:
identifierin interfaceDataCollectionId
-
namespace
public String namespace()
Get the namespace of this collection, which is comprised of thedatabase nameandcollection name.- Returns:
- the namespace for this collection; never null
-
-