Package org.springframework.core.env
Interface PropertyResolver
- All Known Subinterfaces:
- ConfigurableEnvironment,- ConfigurablePropertyResolver,- ConfigurableWebEnvironment,- Environment
- All Known Implementing Classes:
- AbstractEnvironment,- AbstractPropertyResolver,- MockEnvironment,- PropertySourcesPropertyResolver,- StandardEnvironment,- StandardServletEnvironment
public interface PropertyResolver
Interface for resolving properties against any underlying source.
- Since:
- 3.1
- Author:
- Chris Beams, Juergen Hoeller
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionbooleancontainsProperty(String key) Determine whether the given property key is available for resolution — for example, if the value for the given key is notnull.getProperty(String key) Resolve the property value associated with the given key, ornullif the key cannot be resolved.<T> TgetProperty(String key, Class<T> targetType) Resolve the property value associated with the given key, ornullif the key cannot be resolved.<T> TgetProperty(String key, Class<T> targetType, T defaultValue) Resolve the property value associated with the given key, ordefaultValueif the key cannot be resolved.getProperty(String key, String defaultValue) Resolve the property value associated with the given key, ordefaultValueif the key cannot be resolved.Resolve the property value associated with the given key (nevernull).<T> TgetRequiredProperty(String key, Class<T> targetType) Resolve 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).
- 
Method Details- 
containsPropertyDetermine whether the given property key is available for resolution — for example, if the value for the given key is notnull.
- 
getPropertyResolve the property value associated with the given key, ornullif the key cannot be resolved.- Parameters:
- key- the property name to resolve
- See Also:
 
- 
getPropertyResolve the property value associated with the given key, ordefaultValueif the key cannot be resolved.- Parameters:
- key- the property name to resolve
- defaultValue- the default value to return if no value is found
- See Also:
 
- 
getPropertyResolve the property value associated with the given key, ornullif the key cannot be resolved.- Parameters:
- key- the property name to resolve
- targetType- the expected type of the property value
- See Also:
 
- 
getPropertyResolve the property value associated with the given key, ordefaultValueif the key cannot be resolved.- Parameters:
- key- the property name to resolve
- targetType- the expected type of the property value
- defaultValue- the default value to return if no value is found
- See Also:
 
- 
getRequiredPropertyResolve the property value associated with the given key (nevernull).- Throws:
- IllegalStateException- if the key cannot be resolved
- See Also:
 
- 
getRequiredPropertyResolve the property value associated with the given key, converted to the given targetType (nevernull).- Throws:
- IllegalStateException- if the given key cannot be resolved
 
- 
resolvePlaceholdersResolve ${...} 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.- Parameters:
- text- the String to resolve
- Returns:
- the resolved String (never null)
- Throws:
- IllegalArgumentException- if given text is- null
- See Also:
 
- 
resolveRequiredPlaceholdersResolve ${...} 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.- Returns:
- the resolved String (never null)
- Throws:
- IllegalArgumentException- if given text is- nullor if any placeholders are unresolvable
 
 
-