Interface ContextService
public interface ContextService
A 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
Set
of Context
s, 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 the Set
of contexts defined in the query
contain all of the Context
s 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
Modifier and TypeMethodDescriptioncontexts()
Get the active contexts from the current cause.contextsFor
(Cause cause) Extract applicable contexts from the providedCause
.void
registerContextCalculator
(ContextCalculator calculator) Registers aContextCalculator
for use by this service.
-
Method Details
-
contexts
Get the active contexts from the current cause.- Returns:
- an immutable set of contexts
-
contextsFor
Extract applicable contexts from the providedCause
.- Parameters:
cause
- source cause- Returns:
- immutable set of extracted contexts
-
registerContextCalculator
Registers aContextCalculator
for use by this service.- Parameters:
calculator
- The context calculator to register
-