Class CollectionId

    • Field Detail

      • replicaSetName

        private final String replicaSetName
      • dbName

        private final String dbName
      • name

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

      • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode 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