public class MutableGenericContextImpl extends AbstractMutableGenericContext
MutableGenericContext
interface.Modifier and Type | Field and Description |
---|---|
private GenericValueConverter<Object> |
valueConverter |
Constructor and Description |
---|
MutableGenericContextImpl(MapFactory<? extends Map> mapFactory)
The constructor for a root-context.
|
MutableGenericContextImpl(MapFactory<? extends Map> mapFactory,
GenericContext parentContext)
The constructor for a
sub-context . |
MutableGenericContextImpl(MapFactory<? extends Map> mapFactory,
GenericContext parentContext,
GenericValueConverter<Object> valueConverter)
The constructor for a
sub-context . |
MutableGenericContextImpl(MapFactory<? extends Map> mapFactory,
GenericValueConverter<Object> valueConverter)
The constructor for a
sub-context . |
Modifier and Type | Method and Description |
---|---|
MutableGenericContext |
createChildContext()
This method creates a new context that inherits all variables from this context (and its parent contexts).
|
<T> T |
getVariable(String variableName,
Class<T> type)
This method gets the variable associated with the given
variableName as the given type . |
getImmutableContext, getMapFactory, getVariable, getVariable, getVariableName, getVariableNames, hasVariable, removeVariable, requireVariable, requireVariable, requireVariable, setVariable, setVariable, toMap
private final GenericValueConverter<Object> valueConverter
getVariable(String, Class)
public MutableGenericContextImpl(MapFactory<? extends Map> mapFactory)
mapFactory
- is used to create the map for storing variables.public MutableGenericContextImpl(MapFactory<? extends Map> mapFactory, GenericValueConverter<Object> valueConverter)
sub-context
.mapFactory
- is used to create the map for storing variables.valueConverter
- is the GenericValueConverter
used to convert variables that are
requested
as a different type.public MutableGenericContextImpl(MapFactory<? extends Map> mapFactory, GenericContext parentContext)
sub-context
.mapFactory
- is used to create the map for storing variables.parentContext
- is the context the created one will derive from.public MutableGenericContextImpl(MapFactory<? extends Map> mapFactory, GenericContext parentContext, GenericValueConverter<Object> valueConverter)
sub-context
.mapFactory
- is used to create the map for storing variables.parentContext
- is the context the created one will derive from.valueConverter
- is the GenericValueConverter
used to convert variables that are
requested
as a different type.public <T> T getVariable(String variableName, Class<T> type)
GenericContext
variableName
as the given type
. If the
type
does NOT match the actual type of the variable it may automatically be converted as possible.T
- 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 MutableGenericContext createChildContext()
GenericContext
Copyright © 2001–2016 mmm-Team. All rights reserved.