public interface ContextualRegistry extends Context
Context contains also a notion of classifiers. Classifier is any object defining additional key for registered objects. To obtain such registered object, the same classifier (precisely, any equal object) has to be used.
Classifiers can be used as follows:
String, ...
// User detail provider service
registry.register("NAME_PARAM_ID", "Smith");
registry.register("GENDER_PARAM_ID", "male");
...
// User consumer service
String name = registry.get("name", String.class);
// In some central security service.
registry.register(securityFrameworkInternalInstance, new AuthenticatedInternalIdentity(...));
...
// In some authorization filter known by a central security service
AuthenticatedInternalIdentity auth = registry.get(securityFrameworkInternalInstance, AuthenticatedInternalIdentity.class);
Context.Builder| Modifier and Type | Method and Description |
|---|---|
static ContextualRegistry |
create()
Creates a new empty instance.
|
static ContextualRegistry |
create(Context parent)
Creates a new empty instance backed by its parent read-through
ContextualRegistry. |
static ContextualRegistry create()
static ContextualRegistry create(Context parent)
ContextualRegistry.
Parent registry is used only for get methods and only if this registry doesn't have registered required type.
Copyright © 2018–2019 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.