public abstract class AbstractPropertyResolver extends Object implements PropertyResolver
| 构造器和说明 |
|---|
AbstractPropertyResolver() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
containsProperty(String key)
Whether the given property key is available.
|
<R,T> T |
getProperty(String key,
Function<R,T> mappingFunction,
T defaultValue)
Find the property value associated with the given key.
|
String |
getProperty(String key,
String defaultValue)
Find the property value associated with the given key.
|
protected abstract Optional<String> |
getPropertyAsRawString(String key)
Retrieve the specified property as a raw String,
i.e. without resolution of nested placeholders.
|
String |
getRequiredProperty(String key)
Find the property value associated with the given key (never
null). |
<R,T> T |
getRequiredProperty(String key,
Function<R,T> mappingFunction)
Find the property value associated with the given key (never
null). |
protected String |
resolveNestedPlaceholders(String value)
Resolve placeholders within the given string.
|
String |
resolvePlaceholders(String text)
Resolve ${...} placeholders in the given text, replacing them with corresponding
property values as resolved by
PropertyResolver.getProperty(java.lang.String). |
String |
resolveRequiredPlaceholders(String text)
Resolve ${...} placeholders in the given text, replacing them with corresponding
property values as resolved by
PropertyResolver.getProperty(java.lang.String). |
void |
setPlaceholderPrefix(String placeholderPrefix)
Set the prefix that placeholders replaced by this resolver must begin with.
|
void |
setPlaceholderSuffix(String placeholderSuffix)
Set the suffix that placeholders replaced by this resolver must end with.
|
void |
setValueSeparator(String valueSeparator)
Specify the separating character between the placeholders replaced by this
resolver and their associated default value, or
null if no such
special character should be processed as a value separator. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetProperty, getPropertyprotected final Logger log
public boolean containsProperty(String key)
PropertyResolvercontainsProperty 在接口中 PropertyResolverpublic String getProperty(String key, String defaultValue)
PropertyResolvergetProperty 在接口中 PropertyResolverkey - the property name to resolvedefaultValue - the default value to return if no value is foundPropertyResolver.getRequiredProperty(String),
PropertyResolver.getProperty(String, Function)public <R,T> T getProperty(String key, Function<R,T> mappingFunction, T defaultValue)
PropertyResolvergetProperty 在接口中 PropertyResolverkey - the property name to resolvemappingFunction - the mapping function convert original object to target objetdefaultValue - the default value to return if no value is foundPropertyResolver.getRequiredProperty(String, Function)public String getRequiredProperty(String key) throws IllegalStateException
PropertyResolvernull).getRequiredProperty 在接口中 PropertyResolverkey - the property name to resolveIllegalStateException - if the key cannot be resolvedPropertyResolver.getRequiredProperty(String, Function)public <R,T> T getRequiredProperty(String key, Function<R,T> mappingFunction) throws IllegalStateException
PropertyResolvernull).getRequiredProperty 在接口中 PropertyResolverkey - the property name to resolvemappingFunction - the mapping function convert original object to target objetIllegalStateException - if the given key cannot be resolvedpublic String resolvePlaceholders(String text)
PropertyResolverPropertyResolver.getProperty(java.lang.String). Unresolvable placeholders with
no default value are ignored and passed through unchanged.resolvePlaceholders 在接口中 PropertyResolvertext - the String to resolvenull)PropertyResolver.resolveRequiredPlaceholders(java.lang.String)public String resolveRequiredPlaceholders(String text) throws IllegalArgumentException
PropertyResolverPropertyResolver.getProperty(java.lang.String). Unresolvable placeholders with
no default value will cause an IllegalArgumentException to be thrown.resolveRequiredPlaceholders 在接口中 PropertyResolvernull)IllegalArgumentException - if given text is null
or if any placeholders are unresolvableprotected String resolveNestedPlaceholders(String value)
public void setPlaceholderPrefix(String placeholderPrefix)
PropertyResolversetPlaceholderPrefix 在接口中 PropertyResolverpublic void setPlaceholderSuffix(String placeholderSuffix)
PropertyResolversetPlaceholderSuffix 在接口中 PropertyResolverpublic void setValueSeparator(String valueSeparator)
PropertyResolvernull if no such
special character should be processed as a value separator.setValueSeparator 在接口中 PropertyResolverCopyright © 2021. All rights reserved.