|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mmm.util.context.base.AbstractGenericContextProxy
public abstract class AbstractGenericContextProxy
This is an abstract base implementation of the
GenericContext interface that delegates
to another instance.
| Constructor Summary | |
|---|---|
AbstractGenericContextProxy()
The constructor. |
|
| Method Summary | ||
|---|---|---|
MutableGenericContext |
createChildContext()
This method creates a new context that inherits all variables from this context (and its parent contexts). |
|
protected abstract GenericContext |
getContext()
This method gets the delegate instance this proxy points to. |
|
|
getVariable(Class<T> type)
This method gets the variable associated with the given type. |
|
Object |
getVariable(String variableName)
This method gets the variable associated with the given variableName. |
|
|
getVariable(String variableName,
Class<T> type)
This method gets the variable associated with the given variableName as the given type. |
|
Set<String> |
getVariableNames()
This method returns the names of all defined variables. |
|
boolean |
hasVariable(String variableName)
This method determines if the variable for the
given variableName exists. |
|
|
requireVariable(Class<T> type)
This method gets the variable associated with the given type. |
|
Object |
requireVariable(String variableName)
This method gets the variable associated with the given variableName. |
|
|
requireVariable(String variableName,
Class<T> type)
This method gets the variable associated with the given variableName. |
|
Map<String,Object> |
toMap()
This method allows to create a Map representing the variables of
this context. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractGenericContextProxy()
| Method Detail |
|---|
protected abstract GenericContext getContext()
public Object requireVariable(String variableName)
throws ValueNotSetException
variableName.
requireVariable in interface GenericContextvariableName - is the name of the requested variable.
ValueNotSetException - if the requested variable is NOT set.
public <T> T requireVariable(String variableName,
Class<T> type)
throws ValueNotSetException
variableName.
requireVariable in interface GenericContextT - the generic type of the variable.variableName - is the name of the requested variable.type - is the class reflecting the type of the variable.
ValueNotSetException - if the requested variable is NOT set.
public <T> T requireVariable(Class<T> type)
throws ValueNotSetException
type.
It will use the classname as
variable-name.String or Integer are bad candidates while
MySpecificSingletonComponentInterface might be a good option.
requireVariable in interface GenericContextT - the generic type of the variable.type - is the class reflecting the type of the variable.
ValueNotSetException - if the requested variable is NOT set.MutableGenericContext.setVariable(String, Object)public Object getVariable(String variableName)
variableName.
getVariable in interface GenericContextvariableName - is the name of the requested variable.
null if the variable is
NOT set.
public <T> T getVariable(String variableName,
Class<T> type)
variableName as the given type. If the
type does NOT match the actual type of the variable it may
automatically be converted as possible.
getVariable in interface GenericContextT - the generic type of the variable.variableName - is the name of the requested variable.type - is the class reflecting the type of the variable.
null if the variable is
NOT set.public <T> T getVariable(Class<T> type)
type.
It will use the classname as
variable-name.String or Integer are bad candidates while
MySpecificSingletonComponentInterface might be a good option.
getVariable in interface GenericContextT - the generic type of the variable.type - is the class reflecting the type of the variable.
null if the variable is
NOT set.MutableGenericContext.setVariable(String, Object)public boolean hasVariable(String variableName)
variable for the
given variableName exists.
hasVariable in interface GenericContextvariableName - is the name of the requested variable.
true if a value exists for the given
variableName, false otherwise.public Set<String> getVariableNames()
GenericContext.hasVariable(String) where possible.
getVariableNames in interface GenericContextpublic MutableGenericContext createChildContext()
createChildContext in interface GenericContextpublic Map<String,Object> toMap()
Map representing the variables of
this context. This can be useful to pass this context to an external
component (e.g. a template-engine) that typically accepts a Map.Map will NOT reflect
changes of this context and vice versa.
toMap in interface GenericContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||