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 Pattern |
ANT_TEMPLATE_PATTERN |
static String |
ANT_TEMPLATE_STYLE |
static Pattern |
CURLY_TEMPLATE_PATTERN |
static String |
CURLY_TEMPLATE_STYLE |
protected static Log |
logger
logger used by this class
|
static Pattern |
SQUARE_TEMPLATE_PATTERN |
static String |
SQUARE_TEMPLATE_STYLE |
static Pattern |
WIGGLY_MULE_TEMPLATE_PATTERN |
static String |
WIGGLY_MULE_TEMPLATE_STYLE |
Modifier and Type | Method and Description |
---|---|
static TemplateParser |
createAntStyleParser() |
static TemplateParser |
createCurlyBracesStyleParser() |
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 Log logger
public static final Pattern ANT_TEMPLATE_PATTERN
public static final Pattern SQUARE_TEMPLATE_PATTERN
public static final Pattern CURLY_TEMPLATE_PATTERN
public static final Pattern WIGGLY_MULE_TEMPLATE_PATTERN
public static TemplateParser createAntStyleParser()
public static TemplateParser createSquareBracesStyleParser()
public static TemplateParser createCurlyBracesStyleParser()
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
IllegalArgumentException
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.