Class CollectionId

java.lang.Object
io.debezium.connector.mongodb.CollectionId
All Implemented Interfaces:
io.debezium.spi.schema.DataCollectionId

@Immutable public final class CollectionId extends Object implements io.debezium.spi.schema.DataCollectionId
A simple identifier for collections in a replica set.
Author:
Randall Hauch
  • Field Details

    • replicaSetName

      private final String replicaSetName
    • dbName

      private final String dbName
    • name

      private final String name
  • Constructor Details

    • 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 null
      dbName - the name of the database; may not be null
      collectionName - the name of the collection; may not be null
  • Method Details

    • parse

      public static CollectionId parse(String str)
      Parse the supplied <replicaset_name>.<database_name>.<collection_name> string. The collection_name can also contain dots in its value.
      Parameters:
      str - the string representation of the collection identifier; may not be null
      Returns:
      the collection ID, or null if it could not be parsed
    • parse

      public static CollectionId parse(String replicaSetName, String str)
      Parse the supplied <database_name>.<collection_name> string. The collection_name can also contain dots in its value.
      Parameters:
      replicaSetName - the name of replica; may not be null
      str - 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:
      identifier in interface io.debezium.spi.schema.DataCollectionId
    • parts

      public List<String> parts()
      Specified by:
      parts in interface io.debezium.spi.schema.DataCollectionId
    • databaseParts

      public List<String> databaseParts()
      Specified by:
      databaseParts in interface io.debezium.spi.schema.DataCollectionId
    • schemaParts

      public List<String> schemaParts()
      Specified by:
      schemaParts in interface io.debezium.spi.schema.DataCollectionId
    • hashCode

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

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

      public String namespace()
      Get the namespace of this collection, which is comprised of the database name and collection name.
      Returns:
      the namespace for this collection; never null
    • toString

      public String toString()
      Overrides:
      toString in class Object