public class DefaultObservableContext extends DefaultContext implements ObservableContext
ObservableContext.ContextEvent, ObservableContext.ContextEventListener
ERROR_KEY_BLANK
parentContext
Constructor and Description |
---|
DefaultObservableContext() |
DefaultObservableContext(Context parentContext) |
Modifier and Type | Method and Description |
---|---|
void |
addContextEventListener(ObservableContext.ContextEventListener listener) |
void |
destroy()
Destroys this context.
|
protected void |
fireContextEvent(ObservableContext.ContextEvent.Type type,
java.lang.String key,
java.lang.Object oldValue,
java.lang.Object newValue) |
protected void |
fireContextEvent(ObservableContext.ContextEvent event) |
ObservableContext.ContextEventListener[] |
getContextEventListeners() |
void |
put(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.
|
void |
removeContextEventListener(ObservableContext.ContextEventListener listener) |
<T> T |
removeConverted(java.lang.String key,
java.lang.Class<T> type)
Removes a key from this context.
|
doGet, hasKey, keySet, putAt
containsKey, convertValue, get, get, getAs, getAs, getAsBoolean, getAsBoolean, getAsDouble, getAsDouble, getAsFloat, getAsFloat, getAsInt, getAsInt, getAsLong, getAsLong, getAsString, getAsString, getAt, getAt, getConverted, getConverted, getParentContext, injectMembers
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
containsKey, get, get, getAs, getAs, getAsBoolean, getAsBoolean, getAsDouble, getAsDouble, getAsFloat, getAsFloat, getAsInt, getAsInt, getAsLong, getAsLong, getAsString, getAsString, getAt, getAt, getConverted, getConverted, getParentContext, hasKey, injectMembers, keySet, putAt
public DefaultObservableContext()
public DefaultObservableContext(@Nullable Context parentContext)
public void addContextEventListener(@Nonnull ObservableContext.ContextEventListener listener)
addContextEventListener
in interface ObservableContext
public void removeContextEventListener(@Nonnull ObservableContext.ContextEventListener listener)
removeContextEventListener
in interface ObservableContext
@Nonnull public ObservableContext.ContextEventListener[] getContextEventListeners()
getContextEventListeners
in interface ObservableContext
public void put(@Nonnull java.lang.String key, @Nullable java.lang.Object value)
Context
put
in interface Context
put
in class DefaultContext
key
- the key to be registeredvalue
- the value to save@Nullable public java.lang.Object remove(@Nonnull java.lang.String key)
Context
remove
in interface Context
remove
in class DefaultContext
key
- the key to be removed@Nullable public <T> T removeAs(@Nonnull java.lang.String key)
Context
removeAs
in interface Context
removeAs
in class DefaultContext
key
- the key to be removed@Nullable public <T> T removeConverted(@Nonnull java.lang.String key, @Nonnull java.lang.Class<T> type)
Context
PropertyEditor
.removeConverted
in interface Context
removeConverted
in class DefaultContext
key
- the key to be removedtype
- the type to be returnedpublic void destroy()
Context
destroy
in interface Context
destroy
in class DefaultContext
protected void fireContextEvent(@Nonnull ObservableContext.ContextEvent.Type type, @Nonnull java.lang.String key, @Nullable java.lang.Object oldValue, @Nullable java.lang.Object newValue)
protected void fireContextEvent(@Nonnull ObservableContext.ContextEvent event)