public class RelaxedPropertyResolver extends Object implements PropertyResolver
PropertyResolver
that attempts to resolve values using RelaxedNames
.RelaxedNames
Constructor and Description |
---|
RelaxedPropertyResolver(PropertyResolver resolver) |
RelaxedPropertyResolver(PropertyResolver resolver,
String prefix) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsProperty(String key) |
String |
getProperty(String key) |
<T> T |
getProperty(String key,
Class<T> targetType) |
<T> T |
getProperty(String key,
Class<T> targetType,
T defaultValue) |
String |
getProperty(String key,
String defaultValue) |
<T> Class<T> |
getPropertyAsClass(String key,
Class<T> targetType) |
String |
getRequiredProperty(String key) |
<T> T |
getRequiredProperty(String key,
Class<T> targetType) |
static Map<String,Object> |
getSubProperties(PropertySources propertySources,
String keyPrefix)
Return a Map of all values from the specified
PropertySources that start
with a particular key. |
static Map<String,Object> |
getSubProperties(PropertySources propertySources,
String rootPrefix,
String keyPrefix)
Return a Map of all values from the specified
PropertySources that start
with a particular key. |
Map<String,Object> |
getSubProperties(String keyPrefix)
Return a Map of all values from all underlying properties that start with the
specified key.
|
String |
resolvePlaceholders(String text) |
String |
resolveRequiredPlaceholders(String text) |
public RelaxedPropertyResolver(PropertyResolver resolver)
public RelaxedPropertyResolver(PropertyResolver resolver, String prefix)
public String getRequiredProperty(String key) throws IllegalStateException
getRequiredProperty
in interface PropertyResolver
IllegalStateException
public <T> T getRequiredProperty(String key, Class<T> targetType) throws IllegalStateException
getRequiredProperty
in interface PropertyResolver
IllegalStateException
public String getProperty(String key)
getProperty
in interface PropertyResolver
public String getProperty(String key, String defaultValue)
getProperty
in interface PropertyResolver
public <T> T getProperty(String key, Class<T> targetType)
getProperty
in interface PropertyResolver
public <T> T getProperty(String key, Class<T> targetType, T defaultValue)
getProperty
in interface PropertyResolver
public <T> Class<T> getPropertyAsClass(String key, Class<T> targetType)
getPropertyAsClass
in interface PropertyResolver
public boolean containsProperty(String key)
containsProperty
in interface PropertyResolver
public String resolvePlaceholders(String text)
resolvePlaceholders
in interface PropertyResolver
public String resolveRequiredPlaceholders(String text) throws IllegalArgumentException
resolveRequiredPlaceholders
in interface PropertyResolver
IllegalArgumentException
public Map<String,Object> getSubProperties(String keyPrefix)
ConfigurableEnvironment
.keyPrefix
- the key prefix used to filter resultsgetSubProperties(PropertySources, String)
,
getSubProperties(PropertySources, String, String)
public static Map<String,Object> getSubProperties(PropertySources propertySources, String keyPrefix)
PropertySources
that start
with a particular key.propertySources
- the property sources to scankeyPrefix
- the key prefixes to testgetSubProperties(PropertySources, String, String)
public static Map<String,Object> getSubProperties(PropertySources propertySources, String rootPrefix, String keyPrefix)
PropertySources
that start
with a particular key.propertySources
- the property sources to scanrootPrefix
- a root prefix to be prepended to the keyPrefex (can be
null
)keyPrefix
- the key prefixes to testgetSubProperties(PropertySources, String, String)
Copyright © 2014. All rights reserved.