public final class TemplateParser extends Object
TemplateParser
is a simple string parser that will substitute
tokens in a string with values supplied in a Map.Modifier and Type | Class and Description |
---|---|
static interface |
TemplateParser.TemplateCallback |
Modifier and Type | Field and Description |
---|---|
static String |
ANT_TEMPLATE_STYLE |
static String |
CURLY_TEMPLATE_STYLE |
protected static org.apache.commons.logging.Log |
logger
logger used by this class
|
static String |
SQUARE_TEMPLATE_STYLE |
Modifier and Type | Method and Description |
---|---|
static TemplateParser |
createAntStyleParser() |
static TemplateParser |
createCurlyBracesStyleParser() |
static TemplateParser |
createSquareBracesStyleParser() |
String |
getStyle() |
boolean |
isContainsTemplate(String value) |
List |
parse(Map props,
List templates)
Matches one or more templates against a Map of key value pairs.
|
Map |
parse(Map props,
Map templates)
Matches one or more templates against a Map of key value pairs.
|
String |
parse(Map props,
String template)
Matches one or more templates against a Map of key value pairs.
|
protected String |
parse(Map props,
String template,
TemplateParser.TemplateCallback callback) |
Map |
parse(TemplateParser.TemplateCallback callback,
Map templates) |
String |
parse(TemplateParser.TemplateCallback callback,
String template)
Matches one or more templates against a Map of key value pairs.
|
public static final String ANT_TEMPLATE_STYLE
public static final String SQUARE_TEMPLATE_STYLE
public static final String CURLY_TEMPLATE_STYLE
protected static final org.apache.commons.logging.Log logger
public static TemplateParser createAntStyleParser()
public static TemplateParser createSquareBracesStyleParser()
public static TemplateParser createCurlyBracesStyleParser()
public String parse(Map props, String template)
props
- the key/value pairs to match againsttemplate
- the string containing the template place holders i.e. My name
is ${name}public String parse(TemplateParser.TemplateCallback callback, String template)
callback
- a callback used to resolve the property nametemplate
- the string containing the template place holders i.e. My name
is ${name}protected String parse(Map props, String template, TemplateParser.TemplateCallback callback)
public List parse(Map props, List templates)
props
- the key/value pairs to match againsttemplates
- A List of templatespublic Map parse(Map props, Map templates)
props
- the key/value pairs to match againsttemplates
- A Map of templates. The values for each map entry will be
parsedpublic Map parse(TemplateParser.TemplateCallback callback, Map templates)
public String getStyle()
public boolean isContainsTemplate(String value)
Copyright © 2003–2013 MuleSource, Inc.. All rights reserved.