public class Binder extends Object
| Modifier and Type | Field and Description |
|---|---|
static Binder |
DEFAULT_HELPER
默认实例
|
static String |
DEFAULT_PLACEHOLDER_PREFIX
默认占位符前缀: "${"
|
static String |
DEFAULT_PLACEHOLDER_SUFFIX
默认占位符后缀: "}"
|
static String |
DEFAULT_VALUE_SEPARATOR
默认占位值分隔符: ":"
|
| Constructor and Description |
|---|
Binder(String placeholderPrefix,
String placeholderSuffix) |
Binder(String placeholderPrefix,
String placeholderSuffix,
String valueSeparator,
boolean ignoreUnresolvablePlaceholders) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
bind(Class<T> clazz)
绑定属性到类
|
<T> T |
bind(Class<T> clazz,
String prefix)
绑定指定前缀属性到类
|
<T> T |
bind(T obj,
String prefix)
绑定属性到对象实例
|
protected String |
parseStringValue(String value,
Properties properties,
Set<String> visitedPlaceholders) |
String |
replacePlaceholders(String value,
Properties properties)
替换所有占位格式
${name} |
public static final String DEFAULT_PLACEHOLDER_PREFIX
public static final String DEFAULT_PLACEHOLDER_SUFFIX
public static final String DEFAULT_VALUE_SEPARATOR
public static final Binder DEFAULT_HELPER
public <T> T bind(Class<T> clazz)
T - 泛型clazz - 类型public <T> T bind(Class<T> clazz, String prefix)
T - 泛型clazz - 类型prefix - 前缀public <T> T bind(T obj,
String prefix)
T - 泛型obj - 对象实例prefix - 属性前缀public String replacePlaceholders(String value, Properties properties)
${name}value - 需要转换的属性properties - 配置集合protected String parseStringValue(String value, Properties properties, Set<String> visitedPlaceholders)
Copyright © 2020. All rights reserved.