public class SpringEnvironmentPropertyResolver extends Object implements PropertyResolver
| Constructor and Description |
|---|
SpringEnvironmentPropertyResolver(org.springframework.core.env.Environment environment) |
| 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> targetType)
Return the property value associated with the given key, or
null
if the key cannot be resolved. |
<T> T |
getProperty(String key,
Class<T> targetType,
T defaultValue)
Return the property value associated with the given key, or
defaultValue if the key cannot be resolved. |
String |
getProperty(String key,
String defaultValue)
Return the property value associated with the given key, or
defaultValue if the key cannot be resolved. |
String |
getRequiredProperty(String key)
Return the property value associated with the given key (never
null). |
<T> T |
getRequiredProperty(String key,
Class<T> targetType)
Return the property value associated with the given key, converted to the
given targetType (never
null). |
public SpringEnvironmentPropertyResolver(org.springframework.core.env.Environment environment)
public boolean containsProperty(String key)
PropertyResolvernull.containsProperty in interface PropertyResolverkey - the property name to resolvepublic String getProperty(String key)
PropertyResolvernull
if the key cannot be resolved.getProperty in interface PropertyResolverkey - the property name to resolvePropertyResolver.getProperty(String, String),
PropertyResolver.getProperty(String, Class),
PropertyResolver.getRequiredProperty(String)public String getProperty(String key, String defaultValue)
PropertyResolverdefaultValue if the key cannot be resolved.getProperty in interface PropertyResolverkey - the property name to resolvedefaultValue - the default value to return if no value is foundPropertyResolver.getRequiredProperty(String),
PropertyResolver.getProperty(String, Class)public <T> T getProperty(String key, Class<T> targetType)
PropertyResolvernull
if the key cannot be resolved.getProperty in interface PropertyResolverT - the type of the property valuekey - the property name to resolvetargetType - the expected type of the property valuePropertyResolver.getRequiredProperty(String, Class)public <T> T getProperty(String key, Class<T> targetType, T defaultValue)
PropertyResolverdefaultValue if the key cannot be resolved.getProperty in interface PropertyResolverT - the type of the property valuekey - the property name to resolvetargetType - the expected type of the property valuedefaultValue - the default value to return if no value is foundPropertyResolver.getRequiredProperty(String, Class)public String getRequiredProperty(String key)
PropertyResolvernull).getRequiredProperty in interface PropertyResolverkey - the property name to resolvenull)PropertyResolver.getRequiredProperty(String, Class)public <T> T getRequiredProperty(String key, Class<T> targetType)
PropertyResolvernull).getRequiredProperty in interface PropertyResolverT - the type of the property valuekey - the property name to resolvetargetType - the expected type of the property valuenull)Copyright © 2021. All rights reserved.