Package org.miaixz.bus.core
Class Binder
java.lang.Object
org.miaixz.bus.core.Binder
属性绑定器
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T绑定属性到类<T> T绑定指定前缀属性到类<T> T绑定属性到对象实例protected StringparseStringValue(String value, Properties properties, Set<String> visitedPlaceholders) 替换字符串replacePlaceholders(String value, Properties properties) 替换所有占位格式${name}
-
Field Details
-
DEFAULT_PLACEHOLDER_PREFIX
默认占位符前缀: "${"- See Also:
-
DEFAULT_PLACEHOLDER_SUFFIX
默认占位符后缀: "}"- See Also:
-
DEFAULT_VALUE_SEPARATOR
默认占位值分隔符: ":"- See Also:
-
DEFAULT_HELPER
默认实例
-
-
Constructor Details
-
Binder
构造- Parameters:
placeholderPrefix- 占位符前缀placeholderSuffix- 占位符后缀
-
Binder
public Binder(String placeholderPrefix, String placeholderSuffix, String valueSeparator, boolean ignoreUnresolvablePlaceholders) 构造- Parameters:
placeholderPrefix- 占位符前缀placeholderSuffix- 占位符后缀valueSeparator- 值分隔符ignoreUnresolvablePlaceholders- 忽略不可解析的占位符
-
-
Method Details
-
bind
绑定属性到类- Type Parameters:
T- 泛型- Parameters:
clazz- 类型- Returns:
- the object
-
bind
绑定指定前缀属性到类- Type Parameters:
T- 泛型- Parameters:
clazz- 类型prefix- 前缀- Returns:
- the object
-
bind
绑定属性到对象实例- Type Parameters:
T- 泛型- Parameters:
object- 对象实例prefix- 属性前缀- Returns:
- the object
-
replacePlaceholders
替换所有占位格式${name}- Parameters:
value- 需要转换的属性properties- 配置集合- Returns:
- 替换后的字符串
-
parseStringValue
protected String parseStringValue(String value, Properties properties, Set<String> visitedPlaceholders) 替换字符串- Parameters:
value- 字符串properties- 属性visitedPlaceholders- 参数占位符- Returns:
- 替换后的字符串
-