public class DefaultContext extends AbstractContext
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
ERROR_KEY_BLANK |
parentContext
Constructor and Description |
---|
DefaultContext() |
DefaultContext(Context parentContext) |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys this context.
|
protected java.lang.Object |
doGet(java.lang.String key) |
boolean |
hasKey(java.lang.String key)
Searches for the key in this context only.
|
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.
|
containsKey, convertValue, get, get, getAs, getAs, getAsBoolean, getAsBoolean, getAsDouble, getAsDouble, getAsFloat, getAsFloat, getAsInt, getAsInt, getAsLong, getAsLong, getAsString, getAsString, getAt, getAt, getConverted, getConverted, getParentContext, injectMembers
protected static final java.lang.String ERROR_KEY_BLANK
public DefaultContext()
public DefaultContext(@Nullable Context parentContext)
@Nullable protected java.lang.Object doGet(@Nonnull java.lang.String key)
doGet
in class AbstractContext
public boolean hasKey(@Nonnull java.lang.String key)
Context
key
- the key to search@Nullable public java.lang.Object remove(@Nonnull java.lang.String key)
Context
key
- the key to be removed@Nullable public <T> T removeAs(@Nonnull java.lang.String key)
Context
key
- the key to be removed@Nullable public <T> T removeConverted(@Nonnull java.lang.String key, @Nonnull java.lang.Class<T> type)
Context
PropertyEditor
.key
- the key to be removedtype
- the type to be returnedpublic void put(@Nonnull java.lang.String key, @Nullable java.lang.Object value)
Context
key
- the key to be registeredvalue
- the value to savepublic void putAt(@Nonnull java.lang.String key, @Nullable java.lang.Object value)
Context
key
- the key to be registeredvalue
- the value to savepublic void destroy()
Context
destroy
in interface Context
destroy
in class AbstractContext
@Nonnull public java.util.Set<java.lang.String> keySet()
Context
Set
view of the keys contained in this context.