jaxx.runtime.context
Class JAXXInitialContext

java.lang.Object
  extended by jaxx.runtime.context.DefaultJAXXContext
      extended by 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
JAXXInitialContext()
           
 
Method Summary
<O> JAXXInitialContext
add(JAXXContextEntryDef<O> def, O value)
          Register a named (or not) value in the context.
 JAXXInitialContext add(Object value)
          Register a simple (none named) value in the context.
 JAXXInitialContext add(String name, Object value)
          Register a named value in the context.
<T> void
removeContextValue(Class<T> klazz)
          Remove from context the value with the given klazz as an unamed entry
<T> void
removeContextValue(Class<T> klazz, String name)
          Remove from context the value with the given klazz as an unamed (if name is null) or named entry
 void setContextValue(Object o)
          Push in the context a new unamed entry.
 void setContextValue(Object o, String name)
          * Push in the context a new amed entry.
 void to(JAXXContext dst)
          Inject all the registed values into the JAXXObject
 
Methods inherited from class jaxx.runtime.context.DefaultJAXXContext
clear, getContextValue, getContextValue, getEntry, getKey, getKeys, getParentContext, remove0, setParentContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JAXXInitialContext

public JAXXInitialContext()
Method Detail

add

public JAXXInitialContext add(Object value)
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

public JAXXInitialContext add(String name,
                              Object value)
Register a named value in the context.

Parameters:
name - the name of the value
value - the value to registred
Returns:
the instance of the context

add

public <O> JAXXInitialContext add(JAXXContextEntryDef<O> def,
                                  O value)
Register a named (or not) value in the context.

Type Parameters:
O - type of data to add
Parameters:
def - definition of entry
value - the value to registred
Returns:
the instance of the context

to

public void to(JAXXContext dst)
Inject all the registed values into the JAXXObject

Parameters:
dst - the object to fill.

setContextValue

public void setContextValue(Object o)
Description copied from interface: JAXXContext
Push in the context a new unamed entry.

If a previous entry exists in context (unamed and same class), it will be removed.

Specified by:
setContextValue in interface JAXXContext
Overrides:
setContextValue in class DefaultJAXXContext
Parameters:
o - the value to push in context

setContextValue

public void setContextValue(Object o,
                            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:
setContextValue in interface JAXXContext
Overrides:
setContextValue in class DefaultJAXXContext
Parameters:
o - the value to push in context
name - the name of the new entry

removeContextValue

public <T> void removeContextValue(Class<T> klazz)
Description copied from interface: JAXXContext
Remove from context the value with the given klazz as an unamed entry

Specified by:
removeContextValue in interface JAXXContext
Overrides:
removeContextValue in class DefaultJAXXContext
Type Parameters:
T - type of data to remove from context
Parameters:
klazz - the klazz entry

removeContextValue

public <T> void removeContextValue(Class<T> klazz,
                                   String name)
Description copied from interface: JAXXContext
Remove from context the value with the given klazz as an unamed (if name is null) or named entry

Specified by:
removeContextValue in interface JAXXContext
Overrides:
removeContextValue in class DefaultJAXXContext
Type Parameters:
T - type of data to remove from context
Parameters:
klazz - the klazz entry
name - extra name of the entry


Copyright © 2008-2012 CodeLutin. All Rights Reserved.