Class ShardingOptions

    • Constructor Detail

      • ShardingOptions

        public ShardingOptions()
    • Method Detail

      • resolveCollectionName

        public String resolveCollectionName​(String collectionName,
                                            String hint)
        Provides default implementation to resolve the actual collection name from the base name and the hint. By default, the collection name is resolved in the following format {collectionName}{separator}{hint}

        For example, if the base collection name is TEST_COLLECTION, then the resolved collection name when the hint is set to 1 will be TEST_COLLECTION_1

        This can be overridden by the subclasses to provide custom formatting.

        Parameters:
        collectionName - Base collection Name
        hint - hint
        Returns:
        the resolved collection name based on the implementation provided in the method.
      • resolveDatabaseName

        public String resolveDatabaseName​(String databaseName,
                                          String hint)
        Provides default implementation to resolve the actual database name from the base name and the hint. By default, the database name is resolved in the following format {databaseName}{separator}{hint}

        For example, if the database name is TEST_DATABASE with the database hint set to 2, the resolved database name will be TEST_DATABASE_2.

        This can be overridden by a class to provide different way to format the database name and hint.

        Parameters:
        databaseName - Base database Name
        hint - hint
        Returns:
        the resolved database name based on the implementation provided in the method.
      • validateCollectionHint

        public boolean validateCollectionHint​(String collectionName,
                                              String hint)
        Validate if a particular hint is valid for the sharding options or not.
        Parameters:
        collectionName - Base Collection Name
        hint - hint
        Returns:
        true if the hint passed is valid
      • validateDatabaseHint

        public boolean validateDatabaseHint​(String databaseName,
                                            String hint)
        Validate if a particular hint is valid for the sharding options or not.
        Parameters:
        databaseName - Base Database Name
        hint - hint
        Returns:
        true if the hint passed is valid