Interface ContextDefinitionProvider
-
- All Known Subinterfaces:
PermissionsEngine
public interface ContextDefinitionProvider
A repository of context types.- Since:
- 2.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static Set<ContextValue<?>>GLOBAL_CONTEXT
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default @Nullable ContextDefinition<?>contextDefinition(String definitionKey)@Nullable ContextDefinition<?>contextDefinition(String definitionKey, boolean allowFallbacks)<T> booleanregisterContextDefinition(ContextDefinition<T> contextDefinition)Register a new context type that can be queried.intregisterContextDefinitions(ContextDefinition<?>... definitions)Register multiple context definitions.List<ContextDefinition<?>>registeredContextTypes()Get an immutable copy as a list of the registered context typesCompletableFuture<Set<ContextDefinition<?>>>usedContextTypes()
-
-
-
Field Detail
-
GLOBAL_CONTEXT
static final Set<ContextValue<?>> GLOBAL_CONTEXT
-
-
Method Detail
-
usedContextTypes
CompletableFuture<Set<ContextDefinition<?>>> usedContextTypes()
-
registerContextDefinition
<T> boolean registerContextDefinition(ContextDefinition<T> contextDefinition)
Register a new context type that can be queried. If there is another context type registered with the same key as the one trying to be registered, the registration will fail.- Type Parameters:
T- The context value type- Parameters:
contextDefinition- The new context type- Returns:
- whether the context was successfully registered
-
registerContextDefinitions
int registerContextDefinitions(ContextDefinition<?>... definitions)
Register multiple context definitions.- Parameters:
definitions- The definitions to register- Returns:
- The number of definitions that were successfully registered
- See Also:
for details on how individual registrations occur
-
registeredContextTypes
List<ContextDefinition<?>> registeredContextTypes()
Get an immutable copy as a list of the registered context types- Returns:
- The registered context types
-
contextDefinition
default @Nullable ContextDefinition<?> contextDefinition(String definitionKey)
-
contextDefinition
@Nullable ContextDefinition<?> contextDefinition(String definitionKey, boolean allowFallbacks)
-
-