Package jaxx.runtime.context
Class DefaultJAXXContext
java.lang.Object
jaxx.runtime.context.DefaultJAXXContext
- All Implemented Interfaces:
JAXXContext
- Direct Known Subclasses:
DefaultApplicationContext,JAXXInitialContext
public class DefaultJAXXContext extends java.lang.Object implements JAXXContext
The default
JAXXContext to be used in a JAXXObject by
delegation.
The values are store in a Map but we can not use directly the values
as key.
Because, it does not work if we add for the same object multi entries (named
and unamed)...
We prefer use as entry the JAXXContextEntryDef associated with the
value.- Author:
- Tony Chemit - chemit@codelutin.com
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<JAXXContextEntryDef<?>,java.lang.Object>datales données contenues dans le contextprotected static JAXXContextEntryDef<JAXXContext>PARENT_CONTEXT_ENTRYentry of the parent contextprotected JAXXContextparentContextle context parent -
Constructor Summary
Constructors Constructor Description DefaultJAXXContext() -
Method Summary
Modifier and Type Method Description voidclear()<T> TgetContextValue(java.lang.Class<T> clazz)Seek for a unamed entry in the context This is an exemple to call a method in JAXX :<JButton onActionPerformed='{getContextValue(Action.class).method(args[])}'/><T> TgetContextValue(java.lang.Class<T> clazz, java.lang.String name)Seek for a named entry in the contextprotected JAXXContextEntryDef<?>getEntry(java.lang.Class<?> klass, java.lang.String name)protected JAXXContextEntryDef<?>getKey(java.lang.String name, java.lang.Class<?> klass)java.lang.String[]getKeys(java.lang.Class<?> klass)Obtain all the keys of data for a given type.protected JAXXContextgetParentContext()protected <T> Tremove0(java.lang.Class<T> klass, java.lang.String name)<T> voidremoveContextValue(java.lang.Class<T> klazz)Remove from context the value with the given klazz as an unamed entry<T> voidremoveContextValue(java.lang.Class<T> klazz, java.lang.String name)Remove from context the value with the given klazz as an unamed (if name is null) or named entry<T> voidsetContextValue(T o)Push in the context a new unamed entry.<T> voidsetContextValue(T o, java.lang.String name)* Push in the context a new amed entry.protected voidsetParentContext(JAXXContext parentContext)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
PARENT_CONTEXT_ENTRY
entry of the parent context -
parentContext
le context parent -
data
les données contenues dans le context
-
-
Constructor Details
-
DefaultJAXXContext
public DefaultJAXXContext()
-
-
Method Details
-
setContextValue
public <T> void setContextValue(T o)Description copied from interface:JAXXContextPush in the context a new unamed entry. If a previous entry exists in context (unamed and same class), it will be removed.- Specified by:
setContextValuein interfaceJAXXContext- Type Parameters:
T- type of data to set in context- Parameters:
o- the value to push in context
-
setContextValue
public <T> void setContextValue(T o, java.lang.String name)Description copied from interface:JAXXContext* Push in the context a new amed entry. If a previous entry exists in context (same name and class), it will be removed.- Specified by:
setContextValuein interfaceJAXXContext- Type Parameters:
T- type of data to set in context- Parameters:
o- the value to push in contextname- the name of the new entry
-
getContextValue
public <T> T getContextValue(java.lang.Class<T> clazz)Description copied from interface:JAXXContextSeek for a unamed entry in the context This is an exemple to call a method in JAXX :<JButton onActionPerformed='{getContextValue(Action.class).method(args[])}'/>- Specified by:
getContextValuein interfaceJAXXContext- Type Parameters:
T- type of data to obtain from context- Parameters:
clazz- the class of unamed entry to seek in context- Returns:
- the value of the unamed entry for the given class, or
nullif no such entry.
-
getContextValue
public <T> T getContextValue(java.lang.Class<T> clazz, java.lang.String name)Description copied from interface:JAXXContextSeek for a named entry in the context- Specified by:
getContextValuein interfaceJAXXContext- Type Parameters:
T- type of data to obtain from context- Parameters:
clazz- the class of named entry to seek in contextname- the name of the entry to seek in context- Returns:
- the value of the named entry for the given class, or
nullif no such entry.
-
removeContextValue
public <T> void removeContextValue(java.lang.Class<T> klazz)Description copied from interface:JAXXContextRemove from context the value with the given klazz as an unamed entry- Specified by:
removeContextValuein interfaceJAXXContext- Type Parameters:
T- type of data to remove from context- Parameters:
klazz- the klazz entry
-
removeContextValue
public <T> void removeContextValue(java.lang.Class<T> klazz, java.lang.String name)Description copied from interface:JAXXContextRemove from context the value with the given klazz as an unamed (if name is null) or named entry- Specified by:
removeContextValuein interfaceJAXXContext- Type Parameters:
T- type of data to remove from context- Parameters:
klazz- the klazz entryname- extra name of the entry
-
getKeys
public java.lang.String[] getKeys(java.lang.Class<?> klass)Obtain all the keys of data for a given type.- Parameters:
klass- the type of searched keys- Returns:
- the array of all names of keys for the given type of data
- Since:
- 1.3
-
clear
public void clear() -
getKey
-
remove0
protected <T> T remove0(java.lang.Class<T> klass, java.lang.String name) -
getEntry
-
getParentContext
-
setParentContext
-