public abstract class AbstractContext extends java.lang.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(java.lang.String key)
Searches for the key in this context and its hierarchy.
|
protected <T> T |
convertValue(java.lang.Object value,
java.lang.Class<T> type) |
void |
destroy()
Destroys this context.
|
protected abstract java.lang.Object |
doGet(java.lang.String key) |
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. |
<T> T |
injectMembers(T instance)
Inject properties and members annotated with
griffon.inject.Contextual. |
protected Context parentContext
public AbstractContext(@Nullable
Context parentContext)
@Nullable public Context getParentContext()
ContextContext if it exists.getParentContext in interface Context@Nullable
public <T> T get(@Nonnull
java.lang.String key,
@Nullable
T defaultValue)
Context@Nullable
public java.lang.Object getAt(@Nonnull
java.lang.String key)
Context@Nullable
public <T> T getAt(@Nonnull
java.lang.String key,
@Nullable
T defaultValue)
Context@Nullable
public java.lang.Object get(@Nonnull
java.lang.String key)
Contextpublic void destroy()
Contextpublic boolean containsKey(@Nonnull
java.lang.String key)
ContextcontainsKey in interface Contextkey - the key to search@Nullable
protected abstract java.lang.Object doGet(@Nonnull
java.lang.String key)
public boolean getAsBoolean(@Nonnull
java.lang.String key)
ContextgetAsBoolean in interface Contextkey - the key to searchpublic boolean getAsBoolean(@Nonnull
java.lang.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
java.lang.String key)
Contextpublic int getAsInt(@Nonnull
java.lang.String key,
int defaultValue)
Contextpublic long getAsLong(@Nonnull
java.lang.String key)
Contextpublic long getAsLong(@Nonnull
java.lang.String key,
long defaultValue)
Contextpublic float getAsFloat(@Nonnull
java.lang.String key)
ContextgetAsFloat in interface Contextkey - the key to searchpublic float getAsFloat(@Nonnull
java.lang.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
java.lang.String key)
ContextgetAsDouble in interface Contextkey - the key to searchpublic double getAsDouble(@Nonnull
java.lang.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 java.lang.String getAsString(@Nonnull
java.lang.String key)
ContextgetAsString in interface Contextkey - the key to search@Nullable
public java.lang.String getAsString(@Nonnull
java.lang.String key,
@Nullable
java.lang.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
java.lang.String key)
Context@Nullable
public <T> T getAs(@Nonnull
java.lang.String key,
@Nullable
T defaultValue)
Context@Nullable
public <T> T getConverted(@Nonnull
java.lang.String key,
@Nonnull
java.lang.Class<T> type)
ContextPropertyEditor.getConverted in interface Contextkey - the key to searchtype - the type to be returned@Nullable
public <T> T getConverted(@Nonnull
java.lang.String key,
@Nonnull
java.lang.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 foundprotected <T> T convertValue(@Nullable
java.lang.Object value,
@Nonnull
java.lang.Class<T> type)
@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.