public class MapVariableResolver extends Object implements VariableResolver
SimpleVariableResolver but it is used when a map with name/value for
the variables exists already, possibly with a slightly different key (for
instance without the dollar prefix). Subclasses may want to override the
getMapKeyForVariableName(String) method to change the default
assumption about the map keys.| Constructor and Description |
|---|
MapVariableResolver(Map<?,?> nameToValue)
Constructor with name-to-value map.
|
| Modifier and Type | Method and Description |
|---|---|
static MapVariableResolver |
getEnv()
Returns a variable resolver for the ENV variables.
|
String |
getMapKeyForVariableName(String variableName)
Returns the map key for a given variable name.
|
static MapVariableResolver |
getSystemProperties()
Returns a variable resolver for the system properties.
|
Object |
getValue(String name)
Returns the value currently set for the variable given by its name, or
null if no such variable exists.
|
String |
toString() |
public MapVariableResolver(Map<?,?> nameToValue)
nameToValue - the map with variable names as keyspublic static MapVariableResolver getEnv()
System.getenv()public static MapVariableResolver getSystemProperties()
System.getProperties()public String getMapKeyForVariableName(String variableName)
variableName - the variable name, usually prefixed with a dollar sign '$'public Object getValue(String name)
VariableResolvergetValue in interface VariableResolvername - the variable nameCopyright © 2025. All rights reserved.