public class MultipleMapVariableDereferencer extends java.lang.Object implements VariableDereferencer
The MultipleMapVariableDereferencer class implements the VariableDereferencer interface and resolves variable references by looking them up in one or more supplied Map objects.
The keys and values in the supplied Map objects must be String objects.
If more than one contained map has a value for a specific key, the first map's value will be used. ("First", in this case, means the first map added to the MultipleMapVariableDereference object.)
Constructor and Description |
---|
MultipleMapVariableDereferencer()
Creates a new instance of MultipleMapVariableDereferencer
that has no associated Map objects.
|
MultipleMapVariableDereferencer(java.util.Map<java.lang.String,java.lang.String>... maps)
Creates a new instance of MultipleMapVariableDereferencer
that is initialized with a specified set of maps.
|
Modifier and Type | Method and Description |
---|---|
void |
addMap(java.util.Map<java.lang.String,java.lang.String> map)
Add a map to the list of maps to use when dereferencing variable values.
|
java.lang.String |
getVariableValue(java.lang.String varName,
java.lang.Object context)
Get the value associated with a given variable.
|
public MultipleMapVariableDereferencer()
addMap(java.util.Map<java.lang.String, java.lang.String>)
method.public MultipleMapVariableDereferencer(java.util.Map<java.lang.String,java.lang.String>... maps)
maps
- the maps to usepublic final void addMap(java.util.Map<java.lang.String,java.lang.String> map)
map
- The map to addpublic java.lang.String getVariableValue(java.lang.String varName, java.lang.Object context)
getVariableValue
in interface VariableDereferencer
varName
- The name of the variable for which the value is
desired.context
- a context object, passed through from the caller
to the dereferencer, or null if there isn't one.
Ignored here.