public abstract class AbstractContext extends Object implements Context
| Modifier and Type | Field and Description |
|---|---|
protected Context |
parentContext |
| Constructor and Description |
|---|
AbstractContext(Context parentContext) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(String key)
Searches for the key in this context and its hierarchy.
|
protected <T> T |
convertValue(Object value,
Class<T> type) |
void |
destroy()
Destroys this context.
|
protected abstract Object |
doGet(String key) |
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. |
<T> T |
injectMembers(T instance)
Inject properties and members annotated with
griffon.inject.Contextual. |
protected Context parentContext
@Nullable public Context getParentContext()
ContextContext if it exists.getParentContext in interface Context@Nullable public <T> T get(@Nonnull String key, @Nullable T defaultValue)
Context@Nullable public Object getAt(@Nonnull String key)
Context@Nullable public <T> T getAt(@Nonnull String key, @Nullable T defaultValue)
Context@Nullable public Object get(@Nonnull String key)
Contextpublic void destroy()
Contextpublic boolean containsKey(@Nonnull String key)
ContextcontainsKey in interface Contextkey - the key to searchpublic boolean getAsBoolean(@Nonnull String key)
ContextgetAsBoolean in interface Contextkey - the key to searchpublic boolean getAsBoolean(@Nonnull String key, boolean defaultValue)
ContextgetAsBoolean in interface Contextkey - the key to searchdefaultValue - the value to be returned if the key is not foundpublic int getAsInt(@Nonnull String key)
Contextpublic int getAsInt(@Nonnull String key, int defaultValue)
Contextpublic long getAsLong(@Nonnull String key)
Contextpublic long getAsLong(@Nonnull String key, long defaultValue)
Contextpublic float getAsFloat(@Nonnull String key)
ContextgetAsFloat in interface Contextkey - the key to searchpublic float getAsFloat(@Nonnull String key, float defaultValue)
ContextgetAsFloat in interface Contextkey - the key to searchdefaultValue - the value to be returned if the key is not foundpublic double getAsDouble(@Nonnull String key)
ContextgetAsDouble in interface Contextkey - the key to searchpublic double getAsDouble(@Nonnull String key, double defaultValue)
ContextgetAsDouble in interface Contextkey - the key to searchdefaultValue - the value to be returned if the key is not found@Nullable public String getAsString(@Nonnull String key)
ContextgetAsString in interface Contextkey - the key to search@Nullable public String getAsString(@Nonnull String key, @Nullable String defaultValue)
ContextgetAsString in interface Contextkey - the key to searchdefaultValue - the value to be returned if the key is not found@Nullable public <T> T getAs(@Nonnull String key)
Context@Nullable public <T> T getAs(@Nonnull String key, @Nullable T defaultValue)
Context@Nullable public <T> T getConverted(@Nonnull String key, @Nonnull Class<T> type)
ContextPropertyEditor.getConverted in interface Contextkey - the key to searchtype - the type to be returned@Nullable public <T> T getConverted(@Nonnull String key, @Nonnull Class<T> type, @Nullable T defaultValue)
ContextPropertyEditor.
If not found then the supplied defaultValue will be returned.getConverted in interface Contextkey - the key to searchtype - the type to be returneddefaultValue - the value to be returned if the key is not found@Nonnull public <T> T injectMembers(@Nonnull T instance)
Contextgriffon.inject.Contextual.injectMembers in interface ContextT - the type of the instanceinstance - the instance on which contextual members will be injected.