Class DatabaseShardingOptions
- java.lang.Object
-
- com.alpha.mongodb.sharding.core.configuration.ShardingOptions
-
- com.alpha.mongodb.sharding.core.configuration.DatabaseShardingOptions
-
- Direct Known Subclasses:
CompositeShardingOptions
public class DatabaseShardingOptions extends ShardingOptions
Database Sharding options. Provides configuration options that are specifically used for Database Sharding strategy.- Author:
- Shashank Sharma
-
-
Constructor Summary
Constructors Constructor Description DatabaseShardingOptions(List<String> defaultDatabaseHints)
Construct the Database Sharding options using the list of default database hints.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDefaultDatabaseHint()
Get the default database hint if set.boolean
validateDatabaseHint(String databaseName, String hint)
Validate if a particular hint is valid for the sharding options or not.static DatabaseShardingOptions
withIntegerStreamHints(IntStream stream)
A static method to construct DatabaseShardingOptions from an integer stream.-
Methods inherited from class com.alpha.mongodb.sharding.core.configuration.ShardingOptions
resolveCollectionName, resolveDatabaseName, validateCollectionHint
-
-
-
-
Method Detail
-
withIntegerStreamHints
public static DatabaseShardingOptions withIntegerStreamHints(IntStream stream)
A static method to construct DatabaseShardingOptions from an integer stream. This method can be used to create an DatabaseShardingOptions for an integer range, say 0-10DatabaseShardingOptions.withIntegerStreamHints(IntStream.range(0, 10));
- Parameters:
stream
- Integer Stream- Returns:
- DatabaseShardingOptions object
-
getDefaultDatabaseHint
public String getDefaultDatabaseHint()
Get the default database hint if set. If the default hint is not set, then the first hint in the list of hints will be considered for default.- Returns:
- default hint
-
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
-
-