ParserTool Class

The ParserTool is a utility class for easy parsing of String values held in a Map.

The following example shows how the ParserTool is mapped in the toolbox.xml file:

<tool> <key>parser</key> <scope>request</scope> <class>org.apache.velocity.tools.generic.ValueParser</class> </tool>

Direct Known Subclasses:

Example#

@DefaultKey(value="parser") public class ValueParserextends ConversionToolimplements java.util.Map<java.lang.String,java.lang.Object>

This comes in very handy when parsing parameters.

When subkeys are allowed, getValue("foo") will also search for all keys of the form "foo.bar" and return a ValueParser of the type "bar" -> value for all found values.

TODO: someone doing java configuration ought to be able to put a source Map in the tool properties, allowing this to be used like other tools