public final class Contexts
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T> Context<T> |
get(java.lang.Class<T> type)
Return the context with the specified type and an empty "" qualifier.
|
static <T> Context<T> |
get(java.lang.Class<T> type,
java.lang.String qualifier)
Return the context with the specified type and qualifier.
|
static <T> void |
register(java.lang.Class<T> type)
Register the context with the specified type, an empty "" qualifier and a null default value.
|
static <T> void |
register(java.lang.Class<T> type,
java.lang.String qualifier)
Register the context with the specified type, qualifier and a null default value.
|
static <T> void |
register(java.lang.Class<T> type,
java.lang.String qualifier,
T defaultValue)
Register the context with the specified type, qualifier and a default value.
|
static <T> void |
register(java.lang.Class<T> type,
T defaultValue)
Register the context with the specified type, an empty "" qualifier and a default value.
|
public static <T> void register(@Nonnull java.lang.Class<T> type)
T
- the type of the context value.type
- the type of the context value.register(Class, String, Object)
public static <T> void register(@Nonnull java.lang.Class<T> type, @Nullable T defaultValue)
T
- the type of the context value.type
- the type of the context value.defaultValue
- the default value to return if no provider has been specified higher in the tree.register(Class, String, Object)
public static <T> void register(@Nonnull java.lang.Class<T> type, @Nonnull java.lang.String qualifier)
T
- the type of the context value.type
- the type of the context value.qualifier
- the qualifier to distinguish multiple instances of the the same type.register(Class, String, Object)
public static <T> void register(@Nonnull java.lang.Class<T> type, @Nonnull java.lang.String qualifier, @Nullable T defaultValue)
T
- the type of the context value.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.public static <T> Context<T> get(@Nonnull java.lang.Class<T> type)
T
- the type of the context value.type
- the type of the context value.get(Class, String)
public static <T> Context<T> get(@Nonnull java.lang.Class<T> type, @Nonnull java.lang.String qualifier)
T
- the type of the context value.type
- the type of the context value.qualifier
- the qualifier to distinguish multiple instances of the the same type.get(Class)