public class TemplateUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static Pattern |
KEY_PATTERN |
| Constructor and Description |
|---|
TemplateUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args) |
static String |
parseTemplateWithBean(String template,
Object bean)
The method parses template text and replaces all matching keys with
matching bean property values.
|
static String |
parseTemplateWithMap(String template,
Map<String,Object> data)
The method parses template text and replaces all matching keys with
values found in data map.
|
public static final Pattern KEY_PATTERN
public static String parseTemplateWithMap(String template, Map<String,Object> data)
template - - A template string such as "Hello #{last_name}"data - - key/value pairs to replace keys with values in template
stringpublic static String parseTemplateWithBean(String template, Object bean)
template - - A template string such as "Hello #{last_name}"bean - - A bean which is converted to key/value pair and then used
for template parsingpublic static void main(String[] args)
Copyright © 2019. All rights reserved.