Class ShardingOptions
- java.lang.Object
-
- com.alpha.mongodb.sharding.core.configuration.ShardingOptions
-
- Direct Known Subclasses:
CollectionShardingOptions
,DatabaseShardingOptions
public class ShardingOptions extends Object
Base class for Sharding options.- Author:
- Shashank Sharma
-
-
Constructor Summary
Constructors Constructor Description ShardingOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
resolveCollectionName(String collectionName, String hint)
Provides default implementation to resolve the actual collection name from the base name and the hint.String
resolveDatabaseName(String databaseName, String hint)
Provides default implementation to resolve the actual database name from the base name and the hint.boolean
validateCollectionHint(String collectionName, String hint)
Validate if a particular hint is valid for the sharding options or not.boolean
validateDatabaseHint(String databaseName, String hint)
Validate if a particular hint is valid for the sharding options or not.
-
-
-
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 Namehint
- 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 Namehint
- 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 Namehint
- hint- Returns:
- true if the hint passed is valid
-
-