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