Class ShardingHintManager
- java.lang.Object
-
- com.alpha.mongodb.sharding.core.hint.ShardingHintManager
-
public class ShardingHintManager extends Object
Sharding Hint to set Database and Table shard suffix for the current thread. The values set for a particular query will be propagated to all the queries unless explicitly cleared.- Author:
- Shashank Sharma
-
-
Constructor Summary
Constructors Constructor Description ShardingHintManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<ShardingHint>
clear()
Clear the current value if exists and return the value before clearingstatic Optional<ShardingHint>
getHint()
Get the current Hint value if existsstatic void
setCollectionHint(String collectionHint)
Sets the Collection Hint for the current thread.static void
setCompositeHint(String databaseHint, String collectionHint)
Set the composite hint for the current threadstatic void
setDatabaseHint(String databaseHint)
Sets the Database Hint for the current thread.
-
-
-
Method Detail
-
setDatabaseHint
public static void setDatabaseHint(String databaseHint)
Sets the Database Hint for the current thread.- Parameters:
databaseHint
- Database Hint
-
setCollectionHint
public static void setCollectionHint(String collectionHint)
Sets the Collection Hint for the current thread.- Parameters:
collectionHint
- Collection Hint
-
setCompositeHint
public static void setCompositeHint(String databaseHint, String collectionHint)
Set the composite hint for the current thread- Parameters:
databaseHint
- database hintcollectionHint
- collection hint
-
getHint
public static Optional<ShardingHint> getHint()
Get the current Hint value if exists- Returns:
- Optional Hint value
-
clear
public static Optional<ShardingHint> clear()
Clear the current value if exists and return the value before clearing- Returns:
- Optional Hint value
-
-