接口 PropertyResolver
- 所有已知子接口:
ConfigurableEnvironment,ConfigurablePropertyResolver,Environment,IterablePropertyResolver
- 所有已知实现类:
AbstractEnvironment,AbstractPropertyResolver,MapPropertyResolver,PropertiesPropertyResolver,PropertyResolverComposite,PropertySourcesPropertyResolver,StandardEnvironment,TypedPropertyResolver
public interface PropertyResolver
Interface for resolving properties against any underlying source.
- 从以下版本开始:
- 4.0
- 作者:
- Chris Beams, Juergen Hoeller
- 另请参阅:
-
方法概要
修饰符和类型方法说明booleancontainsProperty(String key) Return whether the given property key is available for resolution, i.e. if the value for the given key is notnull.default booleanRetrieve the flag for the given property key.default booleanRetrieve the flag for the given property key.getProperty(String key) Return the property value associated with the given key, ornullif the key cannot be resolved.<T> TgetProperty(String key, Class<T> targetType) Return the property value associated with the given key, ornullif the key cannot be resolved.<T> TgetProperty(String key, Class<T> targetType, T defaultValue) Return the property value associated with the given key, ordefaultValueif the key cannot be resolved.getProperty(String key, String defaultValue) Return the property value associated with the given key, ordefaultValueif the key cannot be resolved.Return the property value associated with the given key (nevernull).<T> TgetRequiredProperty(String key, Class<T> targetType) Return the property value associated with the given key, converted to the given targetType (nevernull).resolvePlaceholders(String text) Resolve ${...} placeholders in the given text, replacing them with corresponding property values as resolved bygetProperty(java.lang.String).Resolve ${...} placeholders in the given text, replacing them with corresponding property values as resolved bygetProperty(java.lang.String).
-
方法详细资料
-
containsProperty
Return whether the given property key is available for resolution, i.e. if the value for the given key is notnull. -
getProperty
Return the property value associated with the given key, ornullif the key cannot be resolved.- 参数:
key- the property name to resolve- 另请参阅:
-
getProperty
Return the property value associated with the given key, ordefaultValueif the key cannot be resolved.- 参数:
key- the property name to resolvedefaultValue- the default value to return if no value is found- 另请参阅:
-
getProperty
Return the property value associated with the given key, ornullif the key cannot be resolved.- 参数:
key- the property name to resolvetargetType- the expected type of the property value- 另请参阅:
-
getProperty
Return the property value associated with the given key, ordefaultValueif the key cannot be resolved.- 参数:
key- the property name to resolvetargetType- the expected type of the property valuedefaultValue- the default value to return if no value is found- 另请参阅:
-
getRequiredProperty
Return the property value associated with the given key (nevernull).- 抛出:
IllegalStateException- if the key cannot be resolved- 另请参阅:
-
getRequiredProperty
Return the property value associated with the given key, converted to the given targetType (nevernull).- 抛出:
IllegalStateException- if the given key cannot be resolved
-
getFlag
Retrieve the flag for the given property key.- 参数:
key- the property key- 返回:
trueif the property is set to "true", false otherwise
-
getFlag
Retrieve the flag for the given property key.If there isn't a key returns defaultFlag
- 参数:
key- the property key- 返回:
trueif the property is set to "true", false otherwise ,If there isn't a key returns defaultFlag
-
resolvePlaceholders
Resolve ${...} placeholders in the given text, replacing them with corresponding property values as resolved bygetProperty(java.lang.String). Unresolvable placeholders with no default value are ignored and passed through unchanged.- 参数:
text- the String to resolve- 返回:
- the resolved String (never
null) - 抛出:
IllegalArgumentException- if given text isnull- 另请参阅:
-
resolveRequiredPlaceholders
Resolve ${...} placeholders in the given text, replacing them with corresponding property values as resolved bygetProperty(java.lang.String). Unresolvable placeholders with no default value will cause an IllegalArgumentException to be thrown.- 返回:
- the resolved String (never
null) - 抛出:
IllegalArgumentException- if given text isnullor if any placeholders are unresolvable
-