类 PropertyPlaceholderHandler
java.lang.Object
cn.taketoday.util.PropertyPlaceholderHandler
Utility class for working with Strings that have placeholder values in them.
A placeholder takes the form
${name}. Using PropertyPlaceholderHandler
these placeholders can be substituted for user-supplied values.
Values for substitution can be supplied using a Properties instance or
using a PlaceholderResolver.
- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller, Rob Harrop, TODAY 2021/9/28 22:26
-
字段概要
字段修饰符和类型字段说明static final PropertyPlaceholderHandlerstatic final StringPrefix for property placeholders: "${".static final StringSuffix for property placeholders: "}".static final PropertyPlaceholderHandlerstatic final StringValue separator for property placeholders: ":". -
构造器概要
构造器构造器说明PropertyPlaceholderHandler(String placeholderPrefix, String placeholderSuffix) Creates a newPropertyPlaceholderHandlerthat uses the supplied prefix and suffix.PropertyPlaceholderHandler(String placeholderPrefix, String placeholderSuffix, String valueSeparator, boolean ignoreUnresolvablePlaceholders) Creates a newPropertyPlaceholderHandlerthat uses the supplied prefix and suffix. -
方法概要
修饰符和类型方法说明protected StringparseStringValue(String value, PlaceholderResolver placeholderResolver, Set<String> visitedPlaceholders) replacePlaceholders(String value, PlaceholderResolver placeholderResolver) Replaces all placeholders of format${name}with the value returned from the suppliedPlaceholderResolver.replacePlaceholders(String value, Properties properties) Replaces all placeholders of format${name}with the corresponding property from the suppliedProperties.static PropertyPlaceholderHandlershared(boolean ignoreUnresolvablePlaceholders)
-
字段详细资料
-
构造器详细资料
-
PropertyPlaceholderHandler
Creates a newPropertyPlaceholderHandlerthat uses the supplied prefix and suffix. Unresolvable placeholders are ignored.- 参数:
placeholderPrefix- the prefix that denotes the start of a placeholderplaceholderSuffix- the suffix that denotes the end of a placeholder
-
PropertyPlaceholderHandler
public PropertyPlaceholderHandler(String placeholderPrefix, String placeholderSuffix, @Nullable String valueSeparator, boolean ignoreUnresolvablePlaceholders) Creates a newPropertyPlaceholderHandlerthat uses the supplied prefix and suffix.- 参数:
placeholderPrefix- the prefix that denotes the start of a placeholderplaceholderSuffix- the suffix that denotes the end of a placeholdervalueSeparator- the separating character between the placeholder variable and the associated default value, if anyignoreUnresolvablePlaceholders- indicates whether unresolvable placeholders should be ignored (true) or cause an exception (false)
-
-
方法详细资料
-
replacePlaceholders
Replaces all placeholders of format${name}with the corresponding property from the suppliedProperties.- 参数:
value- the value containing the placeholders to be replacedproperties- thePropertiesto use for replacement- 返回:
- the supplied value with placeholders replaced inline
-
replacePlaceholders
Replaces all placeholders of format${name}with the value returned from the suppliedPlaceholderResolver.- 参数:
value- the value containing the placeholders to be replacedplaceholderResolver- thePlaceholderResolverto use for replacement- 返回:
- the supplied value with placeholders replaced inline
-
parseStringValue
-