Package io.nosqlbench.engine.api.scoping
Enum ScopedSupplier
java.lang.Object
java.lang.Enum<ScopedSupplier>
io.nosqlbench.engine.api.scoping.ScopedSupplier
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<ScopedSupplier>,java.lang.constant.Constable
public enum ScopedSupplier extends java.lang.Enum<ScopedSupplier>
Helper class to consolidate the notions of scoping items over different
NB layers of execution.
-
Nested Class Summary
-
Enum Constant Summary
Enum Constants Enum Constant Description callerWhen a supplier is instantiated for caller scope, each time the supplier is accessed, it returns a new instance according to the inner supplier's semantics.singletonOnce a supplier is instantiated for singleton scope, it should provide only one instance of the supplied element for that instance.threadOnce a supplier is instantiated for thread scope, it should provide a unique instance of the supplied element for each thread, according to the inner supplier's semantics. -
Method Summary
Modifier and Type Method Description <T> java.util.function.Supplier<T>supplier(java.util.function.Supplier<T> supplier)static ScopedSuppliervalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static ScopedSupplier[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
singleton
Once a supplier is instantiated for singleton scope, it should provide only one instance of the supplied element for that instance. Multiple instances (separately constructed) of the supplier can each provide their own distinct supplied instance. -
thread
Once a supplier is instantiated for thread scope, it should provide a unique instance of the supplied element for each thread, according to the inner supplier's semantics. -
caller
When a supplier is instantiated for caller scope, each time the supplier is accessed, it returns a new instance according to the inner supplier's semantics.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
supplier
public <T> java.util.function.Supplier<T> supplier(java.util.function.Supplier<T> supplier)
-