Package jaxx.runtime.context
Class JAXXInitialContext
java.lang.Object
jaxx.runtime.context.DefaultJAXXContext
jaxx.runtime.context.JAXXInitialContext
- All Implemented Interfaces:
JAXXContext
public class JAXXInitialContext extends DefaultJAXXContext
An initial context to be inject in a
JAXXObject.
The method add(Object) register a simple value.
The method add(String, Object) register a named value.
The method to(JAXXContext) inject in the JAXXObject the values registred in the initial context.
The initial context is also a "limited" JAXXContext, since we can only use the two methods
DefaultJAXXContext.getContextValue(Class) or DefaultJAXXContext.getContextValue(Class, String).- See Also:
JAXXContext
-
Field Summary
Fields inherited from class jaxx.runtime.context.DefaultJAXXContext
data, PARENT_CONTEXT_ENTRY, parentContext -
Constructor Summary
Constructors Constructor Description JAXXInitialContext() -
Method Summary
Modifier and Type Method Description JAXXInitialContextadd(java.lang.Object value)Register a simple (none named) value in the context.JAXXInitialContextadd(java.lang.String name, java.lang.Object value)Register a named value in the context.<O> JAXXInitialContextadd(JAXXContextEntryDef<O> def, O value)Register a named (or not) value in the context.<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 entryvoidsetContextValue(java.lang.Object o)Push in the context a new unamed entry.voidsetContextValue(java.lang.Object o, java.lang.String name)* Push in the context a new amed entry.voidto(JAXXContext dst)Inject all the registed values into theJAXXObjectMethods inherited from class jaxx.runtime.context.DefaultJAXXContext
clear, getContextValue, getContextValue, getEntry, getKey, getKeys, getParentContext, remove0, setParentContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
JAXXInitialContext
public JAXXInitialContext()
-
-
Method Details
-
add
Register a simple (none named) value in the context.- Parameters:
value- the value to be registred in the context- Returns:
- the instance of the context
-
add
Register a named value in the context.- Parameters:
name- the name of the valuevalue- the value to registred- Returns:
- the instance of the context
-
add
Register a named (or not) value in the context.- Type Parameters:
O- type of data to add- Parameters:
def- definition of entryvalue- the value to registred- Returns:
- the instance of the context
-
to
Inject all the registed values into theJAXXObject- Parameters:
dst- the object to fill.
-
setContextValue
public void setContextValue(java.lang.Object 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- Overrides:
setContextValuein classDefaultJAXXContext- Parameters:
o- the value to push in context
-
setContextValue
public void setContextValue(java.lang.Object 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- Overrides:
setContextValuein classDefaultJAXXContext- Parameters:
o- the value to push in contextname- the name of the new 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- Overrides:
removeContextValuein classDefaultJAXXContext- 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- Overrides:
removeContextValuein classDefaultJAXXContext- Type Parameters:
T- type of data to remove from context- Parameters:
klazz- the klazz entryname- extra name of the entry
-