public class StringTemplates extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
StringTemplates.TemplateFluenter |
| 构造器和说明 |
|---|
StringTemplates() |
| 限定符和类型 | 方法和说明 |
|---|---|
static StringTemplates.TemplateFluenter |
fluenter(String template) |
static String |
format(String template,
Object... args)
format based index
|
static String |
format(String template,
Pattern variablePattern,
Function2<String,Object[],String> valueGetter,
Object... args)
custom formatter
|
static String |
format(String template,
String variablePattern,
Function2<String,Object[],String> valueGetter,
Object... args)
custom formatter
|
static <T> String |
formatWithBean(String template,
T bean)
format based on a bean, the variable: ${fieldName}
|
static String |
formatWithCStyle(String template,
Object... args)
%s, %d
|
static String |
formatWithIndex(String template,
Object... args)
format based index: {0}, {1}, {2}
the index based on 0
|
static String |
formatWithMap(String template,
Map<String,?> map)
format based on a map, the variable: ${key}
|
static String |
formatWithPlaceholder(String template,
Object... args)
format based paceholder: {}
|
public static String formatWithCStyle(String template, Object... args)
template - the templateargs - the argumentsString#format(String, Object...)}public static String formatWithPlaceholder(String template, Object... args)
template - the string templatepublic static String formatWithIndex(String template, Object... args)
template - the string templateformat(String, Object...)public static String format(String template, Object... args)
template - the string templateargs - argsformatWithIndex(String, Object...)public static <T> String formatWithBean(String template, T bean)
T - the bean typetemplate - the string templatebean - the beanpublic static String formatWithMap(String template, Map<String,?> map)
template - the string templatepublic static String format(String template, String variablePattern, Function2<String,Object[],String> valueGetter, Object... args)
template - the string templatevariablePattern - variable pattern in templatevalueGetter - variable's value getter, will get value from argsargs - argspublic static String format(String template, Pattern variablePattern, Function2<String,Object[],String> valueGetter, Object... args)
template - the string templatevariablePattern - variable pattern in templatevalueGetter - variable's value getter, will get value from argsargs - argspublic static StringTemplates.TemplateFluenter fluenter(String template)
Copyright © 2019. All rights reserved.