@FunctionalInterface public interface StaticContextCalculator extends ContextCalculator<Object>
ContextCalculator which provides the same context
regardless of the subject.| Modifier and Type | Method and Description |
|---|---|
void |
calculate(@NonNull ContextConsumer consumer)
Submits any contexts this calculator determines to be applicable.
|
default void |
calculate(@NonNull Object target,
@NonNull ContextConsumer consumer)
Submits any contexts this calculator determines to be applicable to
the
target contextual subject. |
static StaticContextCalculator |
forSingleContext(String key,
Supplier<String> valueFunction)
Creates a new
StaticContextCalculator that provides a single context. |
estimatePotentialContexts, forSingleContextstatic StaticContextCalculator forSingleContext(String key, Supplier<String> valueFunction)
StaticContextCalculator that provides a single context.key - the key of the context provided by the calculatorvalueFunction - the function used to compute the corresponding value
for each query. A context will not be "accumulated"
if the value returned is null.void calculate(@NonNull ContextConsumer consumer)
Care should be taken to ensure implementations of this method meet the
general requirements for ContextCalculator, defined in the class
doc.
consumer - the ContextConsumer to submit contexts todefault void calculate(@NonNull Object target, @NonNull ContextConsumer consumer)
ContextCalculatortarget contextual subject.
Care should be taken to ensure implementations of this method meet the
general requirements for ContextCalculator, defined in the class
doc.
calculate in interface ContextCalculator<Object>target - the target contextual subject for this operationconsumer - the ContextConsumer to submit contexts to