public interface Context
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(String key)
Searches for the key in this context and its hierarchy.
|
void |
destroy()
Destroys this context.
|
Object |
get(String key)
Returns the value associated with the given key.
|
<T> T |
get(String key,
T defaultValue)
Returns the value associated with the given key.
|
<T> T |
getAs(String key)
/**
Finds a value associated with the given key.
|
<T> T |
getAs(String key,
T defaultValue)
Finds a value associated with the given key.
|
boolean |
getAsBoolean(String key)
Finds a value associated with the given key.
|
boolean |
getAsBoolean(String key,
boolean defaultValue)
Finds a value associated with the given key.
|
double |
getAsDouble(String key)
Finds a value associated with the given key.
|
double |
getAsDouble(String key,
double defaultValue)
Finds a value associated with the given key.
|
float |
getAsFloat(String key)
Finds a value associated with the given key.
|
float |
getAsFloat(String key,
float defaultValue)
Finds a value associated with the given key.
|
int |
getAsInt(String key)
Finds a value associated with the given key.
|
int |
getAsInt(String key,
int defaultValue)
Finds a value associated with the given key.
|
long |
getAsLong(String key)
Finds a value associated with the given key.
|
long |
getAsLong(String key,
long defaultValue)
Finds a value associated with the given key.
|
String |
getAsString(String key)
Finds a value associated with the given key.
|
String |
getAsString(String key,
String defaultValue)
Finds a value associated with the given key.
|
Object |
getAt(String key)
Returns the value associated with the given key.
|
<T> T |
getAt(String key,
T defaultValue)
Returns the value associated with the given key.
|
<T> T |
getConverted(String key,
Class<T> type)
/**
Finds a value associated with the given key.
|
<T> T |
getConverted(String key,
Class<T> type,
T defaultValue)
Finds a value associated with the given key.
|
Context |
getParentContext()
Returns the parent
Context if it exists. |
boolean |
hasKey(String key)
Searches for the key in this context only.
|
<T> T |
injectMembers(T instance)
Inject properties and members annotated with
griffon.inject.Contextual. |
Set<String> |
keySet()
Returns a
Set view of the keys contained in this context. |
void |
put(String key,
Object value)
Sets a key/value pair on this context.
|
void |
putAt(String key,
Object value)
Sets a key/value pair on this context.
|
Object |
remove(String key)
Removes a key from this context.
|
<T> T |
removeAs(String key)
Removes a key from this context.
|
<T> T |
removeConverted(String key,
Class<T> type)
Removes a key from this context.
|
boolean containsKey(@Nonnull String key)
key - the key to searchboolean hasKey(@Nonnull String key)
key - the key to search@Nullable Object remove(@Nonnull String key)
key - the key to be removed@Nullable <T> T removeAs(@Nonnull String key)
key - the key to be removed@Nullable <T> T removeConverted(@Nonnull String key, @Nonnull Class<T> type)
PropertyEditor.key - the key to be removedtype - the type to be returnedvoid put(@Nonnull String key, @Nullable Object value)
key - the key to be registeredvalue - the value to savevoid putAt(@Nonnull String key, @Nullable Object value)
key - the key to be registeredvalue - the value to save@Nullable Object get(@Nonnull String key)
key - the key to search@Nullable <T> T get(@Nonnull String key, @Nullable T defaultValue)
T - the type of the valuekey - the key to searchdefaultValue - the value to be returned if the key was not found@Nullable Object getAt(@Nonnull String key)
key - the key to search@Nullable <T> T getAt(@Nonnull String key, @Nullable T defaultValue)
T - the type of the valuekey - the key to searchdefaultValue - the value to be returned if the key was not foundvoid destroy()
@Nullable Context getParentContext()
Context if it exists.@Nonnull Set<String> keySet()
Set view of the keys contained in this context.boolean getAsBoolean(@Nonnull String key)
key - the key to searchboolean getAsBoolean(@Nonnull String key, boolean defaultValue)
key - the key to searchdefaultValue - the value to be returned if the key is not foundint getAsInt(@Nonnull String key)
key - the key to searchint getAsInt(@Nonnull String key, int defaultValue)
key - the key to searchdefaultValue - the value to be returned if the key is not foundlong getAsLong(@Nonnull String key)
key - the key to searchlong getAsLong(@Nonnull String key, long defaultValue)
key - the key to searchdefaultValue - the value to be returned if the key is not foundfloat getAsFloat(@Nonnull String key)
key - the key to searchfloat getAsFloat(@Nonnull String key, float defaultValue)
key - the key to searchdefaultValue - the value to be returned if the key is not founddouble getAsDouble(@Nonnull String key)
key - the key to searchdouble getAsDouble(@Nonnull String key, double defaultValue)
key - the key to searchdefaultValue - the value to be returned if the key is not found@Nullable String getAsString(@Nonnull String key)
key - the key to search@Nullable String getAsString(@Nonnull String key, @Nullable String defaultValue)
key - the key to searchdefaultValue - the value to be returned if the key is not found@Nullable <T> T getAs(@Nonnull String key)
key - the key to search@Nullable <T> T getAs(@Nonnull String key, @Nullable T defaultValue)
key - the key to searchdefaultValue - the value to be returned if the key is not found@Nullable <T> T getConverted(@Nonnull String key, @Nonnull Class<T> type)
PropertyEditor.key - the key to searchtype - the type to be returned@Nullable <T> T getConverted(@Nonnull String key, @Nonnull Class<T> type, @Nullable T defaultValue)
PropertyEditor.
If not found then the supplied defaultValue will be returned.key - the key to searchtype - the type to be returneddefaultValue - the value to be returned if the key is not found@Nonnull <T> T injectMembers(@Nonnull T instance)
griffon.inject.Contextual.T - the type of the instanceinstance - the instance on which contextual members will be injected.