Class MultiVariableExpander
java.lang.Object
org.apache.commons.digester3.substitution.MultiVariableExpander
- All Implemented Interfaces:
VariableExpander
Expands variable references from multiple sources.
- Since:
- 1.6
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a new variables source, identified by the input markerReturn the input string with any variables replaced by their corresponding value.Replace any occurrences within the string of the form "marker{key}" with the value from source[key].
-
Constructor Details
-
MultiVariableExpander
public MultiVariableExpander()
-
-
Method Details
-
addSource
Add a new variables source, identified by the input marker- Parameters:
marker- The input variables markersource- The variables source
-
expand
Return the input string with any variables replaced by their corresponding value. If there are no variables in the string, then the input parameter is returned unaltered.- Specified by:
expandin interfaceVariableExpander- Parameters:
param- the string containing variables to be replaced.- Returns:
- the input string with any variables replaced by their corresponding value.
-
expand
Replace any occurrences within the string of the form "marker{key}" with the value from source[key].Commonly, the variable marker is "$", in which case variables are indicated by ${key} in the string.
Returns the string after performing all substitutions.
If no substitutions were made, the input string object is returned (not a copy).
- Parameters:
str- The input string containing placeholdersmarker- The input variables markersource- The variables source- Returns:
- The input string where variables have been expanded by replacing values found in source
-