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 class |
TemplateParser.PatternInfo |
static interface |
TemplateParser.TemplateCallback |
| Modifier and Type | Field and Description |
|---|---|
static String |
ANT_TEMPLATE_STYLE |
static String |
CURLY_TEMPLATE_STYLE |
protected static org.slf4j.Logger |
logger
logger used by this class
|
static String |
SQUARE_TEMPLATE_STYLE |
static String |
WIGGLY_MULE_TEMPLATE_STYLE |
| Modifier and Type | Method and Description |
|---|---|
static TemplateParser |
createAntStyleParser() |
static TemplateParser |
createMuleStyleParser() |
static TemplateParser |
createSquareBracesStyleParser() |
TemplateParser.PatternInfo |
getStyle() |
boolean |
isContainsTemplate(String value) |
boolean |
isValid(String expression) |
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.
|
void |
validate(String expression) |
public static final String ANT_TEMPLATE_STYLE
public static final String SQUARE_TEMPLATE_STYLE
public static final String CURLY_TEMPLATE_STYLE
public static final String WIGGLY_MULE_TEMPLATE_STYLE
protected static final org.slf4j.Logger logger
public static TemplateParser createAntStyleParser()
public static TemplateParser createSquareBracesStyleParser()
public static TemplateParser createMuleStyleParser()
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 TemplateParser.PatternInfo getStyle()
public boolean isContainsTemplate(String value)
public boolean isValid(String expression)
public void validate(String expression) throws IllegalArgumentException
IllegalArgumentExceptionCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.