Interface ContextService
-
public interface ContextServiceA service that provides shared context calculation functionality for any services that may wish to use contexts.When functionality is provided to query data based upon a given
SetofContexts, the querying code must consider which of the underlying data is "applicable" to the contexts specified in the query request. It is expected that implementations will deem entries of underlying data to be applicable if theSetof contexts defined in the query contain all of theContexts required by the data entry. Mathematically, an underlying data entry is "applicable" if [the context of the entry] is a subset of [the context provided in the query], or programmatically if [the context provided in the query]Set.containsAll(Collection)of [the context of the entry].
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Set<Context>contexts()Get the active contexts from the current cause.Set<Context>contextsFor(Cause cause)Extract applicable contexts from the providedCause.voidregisterContextCalculator(ContextCalculator calculator)Registers aContextCalculatorfor use by this service.
-
-
-
Method Detail
-
contexts
Set<Context> contexts()
Get the active contexts from the current cause.- Returns:
- an immutable set of contexts
-
contextsFor
Set<Context> contextsFor(Cause cause)
Extract applicable contexts from the providedCause.- Parameters:
cause- source cause- Returns:
- immutable set of extracted contexts
-
registerContextCalculator
void registerContextCalculator(ContextCalculator calculator)
Registers aContextCalculatorfor use by this service.- Parameters:
calculator- The context calculator to register
-
-