Package react4j
Class Contexts
java.lang.Object
react4j.Contexts
A global registry containing the react contexts that have been created.
A react context is expected to be registered with a java type and an optional qualifier.
This allows multiple contexts of the same type to be present in the global registry.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Context<T>
Return the context with the specified type and an empty "" qualifier.static <T> Context<T>
Return the context with the specified type and qualifier.static <T> void
Register the context with the specified type, an empty "" qualifier and a null default value.static <T> void
Register the context with the specified type, qualifier and a null default value.static <T> void
Register the context with the specified type, qualifier and a default value.static <T> void
Register the context with the specified type, an empty "" qualifier and a default value.
-
Method Details
-
register
Register the context with the specified type, an empty "" qualifier and a null default value. A context with matching type and qualifier parameters must not have been already registered.- Type Parameters:
T
- the type of the context value.- Parameters:
type
- the type of the context value.- See Also:
-
register
Register the context with the specified type, an empty "" qualifier and a default value. A context with matching type and qualifier parameters must not have been already registered.- Type Parameters:
T
- the type of the context value.- Parameters:
type
- the type of the context value.defaultValue
- the default value to return if no provider has been specified higher in the tree.- See Also:
-
register
Register the context with the specified type, qualifier and a null default value. A context with matching type and qualifier parameters must not have been already registered.- Type Parameters:
T
- the type of the context value.- Parameters:
type
- the type of the context value.qualifier
- the qualifier to distinguish multiple instances of the the same type.- See Also:
-
register
public static <T> void register(@Nonnull Class<T> type, @Nonnull String qualifier, @Nullable T defaultValue) Register the context with the specified type, qualifier and a default value. A context with matching type and qualifier parameters must not have been already registered.- Type Parameters:
T
- the type of the context value.- Parameters:
type
- the type of the context value.qualifier
- the qualifier to distinguish multiple instances of the the same type.defaultValue
- the default value to return if no provider has been specified higher in the tree.
-
get
Return the context with the specified type and an empty "" qualifier. A context with matching type and qualifier parameters must have already been registered.- Type Parameters:
T
- the type of the context value.- Parameters:
type
- the type of the context value.- Returns:
- the context.
- See Also:
-
get
Return the context with the specified type and qualifier. A context with matching type and qualifier parameters must have already been registered.- Type Parameters:
T
- the type of the context value.- Parameters:
type
- the type of the context value.qualifier
- the qualifier to distinguish multiple instances of the the same type.- Returns:
- the context.
- See Also:
-