Class DelegatedCollectionShardingOptions
- java.lang.Object
-
- com.alpha.mongodb.sharding.core.configuration.ShardingOptions
-
- com.alpha.mongodb.sharding.core.configuration.CollectionShardingOptions
-
- com.alpha.mongodb.sharding.core.configuration.DelegatedCollectionShardingOptions
-
public class DelegatedCollectionShardingOptions extends CollectionShardingOptions
Delegated Collection Sharding options that is used with CompositeShardingOptions. UseCollectionShardingOptions
for defining sharding options for a collection sharded schema.- Author:
- Shashank Sharma
- See Also:
CollectionShardingOptions
-
-
Constructor Summary
Constructors Constructor Description DelegatedCollectionShardingOptions(CompositeShardingOptions compositeShardingOptions)
-
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.-
Methods inherited from class com.alpha.mongodb.sharding.core.configuration.CollectionShardingOptions
getDefaultCollectionHint, setCollectionHintsMapList, withIntegerStreamHints
-
-
-
-
Constructor Detail
-
DelegatedCollectionShardingOptions
public DelegatedCollectionShardingOptions(CompositeShardingOptions compositeShardingOptions)
-
-
Method Detail
-
resolveDatabaseName
public String resolveDatabaseName(String databaseName, String hint)
Description copied from class:ShardingOptions
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.
- Overrides:
resolveDatabaseName
in classShardingOptions
- Parameters:
databaseName
- Base database Namehint
- hint- Returns:
- the resolved database name based on the implementation provided in the method.
-
resolveCollectionName
public String resolveCollectionName(String collectionName, String hint)
Description copied from class:ShardingOptions
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.
- Overrides:
resolveCollectionName
in classShardingOptions
- Parameters:
collectionName
- Base collection Namehint
- hint- Returns:
- the resolved collection name based on the implementation provided in the method.
-
validateCollectionHint
public boolean validateCollectionHint(String collectionName, String hint)
Description copied from class:ShardingOptions
Validate if a particular hint is valid for the sharding options or not.- Overrides:
validateCollectionHint
in classCollectionShardingOptions
- Parameters:
collectionName
- Base Collection Namehint
- hint- Returns:
- true if the hint passed is valid
-
validateDatabaseHint
public boolean validateDatabaseHint(String databaseName, String hint)
Description copied from class:ShardingOptions
Validate if a particular hint is valid for the sharding options or not.- Overrides:
validateDatabaseHint
in classShardingOptions
- Parameters:
databaseName
- Base Database Namehint
- hint- Returns:
- true if the hint passed is valid
-
-