org.apache.commons.digester.substitution

Class MultiVariableExpander

public class MultiVariableExpander extends Object implements VariableExpander

Expands variable references from multiple sources.

Since: 1.6

Field Summary
ArrayListmarkers
intnEntries
ArrayListsources
Constructor Summary
MultiVariableExpander()
Method Summary
voidaddSource(String marker, Map source)
Stringexpand(String param)
Stringexpand(String str, String marker, Map source)
Replace any occurrences within the string of the form "marker{key}" with the value from source[key].

Field Detail

markers

private ArrayList markers

nEntries

private int nEntries

sources

private ArrayList sources

Constructor Detail

MultiVariableExpander

public MultiVariableExpander()

Method Detail

addSource

public void addSource(String marker, Map source)

expand

public String expand(String param)

expand

public String expand(String str, String marker, Map source)
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).

Throws: IllegalArgumentException if the input param references a variable which is not known to the specified source.

Copyright 2001-2005 The Apache Software Foundation.