public class PropertySourcesPropertyResolver extends AbstractPropertyResolver
PropertyResolver
implementation that resolves property values against
an underlying set of PropertySources
.PropertySource
,
PropertySources
,
AbstractEnvironment
conversionService, logger
Constructor and Description |
---|
PropertySourcesPropertyResolver(PropertySources propertySources)
Create a new resolver against the given property sources.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsProperty(String key)
Return whether the given property key is available for resolution, i.e.,
the value for the given key is not
null . |
String |
getProperty(String key)
Return the property value associated with the given key, or
null
if the key cannot be resolved. |
<T> T |
getProperty(String key,
Class<T> targetValueType)
Return the property value associated with the given key, or
null
if the key cannot be resolved. |
protected <T> T |
getProperty(String key,
Class<T> targetValueType,
boolean resolveNestedPlaceholders) |
<T> Class<T> |
getPropertyAsClass(String key,
Class<T> targetValueType)
Convert the property value associated with the given key to a
Class
of type T or null if the key cannot be resolved. |
protected String |
getPropertyAsRawString(String key)
Retrieve the specified property as a raw String,
i.e.
|
getConversionService, getProperty, getProperty, getRequiredProperty, getRequiredProperty, resolveNestedPlaceholders, resolvePlaceholders, resolveRequiredPlaceholders, setConversionService, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, validateRequiredProperties
public PropertySourcesPropertyResolver(PropertySources propertySources)
propertySources
- the set of PropertySource
objects to usepublic boolean containsProperty(String key)
PropertyResolver
null
.public String getProperty(String key)
PropertyResolver
null
if the key cannot be resolved.key
- the property name to resolvePropertyResolver.getProperty(String, String)
,
PropertyResolver.getProperty(String, Class)
,
PropertyResolver.getRequiredProperty(String)
public <T> T getProperty(String key, Class<T> targetValueType)
PropertyResolver
null
if the key cannot be resolved.key
- the property name to resolvetargetValueType
- the expected type of the property valuePropertyResolver.getRequiredProperty(String, Class)
protected String getPropertyAsRawString(String key)
AbstractPropertyResolver
getPropertyAsRawString
in class AbstractPropertyResolver
key
- the property name to resolvenull
if none foundprotected <T> T getProperty(String key, Class<T> targetValueType, boolean resolveNestedPlaceholders)
public <T> Class<T> getPropertyAsClass(String key, Class<T> targetValueType)
PropertyResolver
Class
of type T
or null
if the key cannot be resolved.