org.springframework.boot.bind
Class RelaxedPropertyResolver

java.lang.Object
  extended by org.springframework.boot.bind.RelaxedPropertyResolver
All Implemented Interfaces:
org.springframework.core.env.PropertyResolver

public class RelaxedPropertyResolver
extends Object
implements org.springframework.core.env.PropertyResolver

PropertyResolver that attempts to resolve values using RelaxedNames.

Author:
Phillip Webb
See Also:
RelaxedNames

Constructor Summary
RelaxedPropertyResolver(org.springframework.core.env.PropertyResolver resolver)
           
RelaxedPropertyResolver(org.springframework.core.env.PropertyResolver resolver, String prefix)
           
 
Method Summary
 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(org.springframework.core.env.PropertySources propertySources, RelaxedNames keyPrefix)
          Return a Map of all values from the specified PropertySources that start with a particular key.
static Map<String,Object> getSubProperties(org.springframework.core.env.PropertySources propertySources, String rootPrefix, RelaxedNames 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelaxedPropertyResolver

public RelaxedPropertyResolver(org.springframework.core.env.PropertyResolver resolver)

RelaxedPropertyResolver

public RelaxedPropertyResolver(org.springframework.core.env.PropertyResolver resolver,
                               String prefix)
Method Detail

getRequiredProperty

public String getRequiredProperty(String key)
                           throws IllegalStateException
Specified by:
getRequiredProperty in interface org.springframework.core.env.PropertyResolver
Throws:
IllegalStateException

getRequiredProperty

public <T> T getRequiredProperty(String key,
                                 Class<T> targetType)
                      throws IllegalStateException
Specified by:
getRequiredProperty in interface org.springframework.core.env.PropertyResolver
Throws:
IllegalStateException

getProperty

public String getProperty(String key)
Specified by:
getProperty in interface org.springframework.core.env.PropertyResolver

getProperty

public String getProperty(String key,
                          String defaultValue)
Specified by:
getProperty in interface org.springframework.core.env.PropertyResolver

getProperty

public <T> T getProperty(String key,
                         Class<T> targetType)
Specified by:
getProperty in interface org.springframework.core.env.PropertyResolver

getProperty

public <T> T getProperty(String key,
                         Class<T> targetType,
                         T defaultValue)
Specified by:
getProperty in interface org.springframework.core.env.PropertyResolver

getPropertyAsClass

public <T> Class<T> getPropertyAsClass(String key,
                                       Class<T> targetType)
Specified by:
getPropertyAsClass in interface org.springframework.core.env.PropertyResolver

containsProperty

public boolean containsProperty(String key)
Specified by:
containsProperty in interface org.springframework.core.env.PropertyResolver

resolvePlaceholders

public String resolvePlaceholders(String text)
Specified by:
resolvePlaceholders in interface org.springframework.core.env.PropertyResolver

resolveRequiredPlaceholders

public String resolveRequiredPlaceholders(String text)
                                   throws IllegalArgumentException
Specified by:
resolveRequiredPlaceholders in interface org.springframework.core.env.PropertyResolver
Throws:
IllegalArgumentException

getSubProperties

public Map<String,Object> getSubProperties(String keyPrefix)
Return a Map of all values from all underlying properties that start with the specified key. NOTE: this method can only be used in the underlying resolver is a ConfigurableEnvironment.

Parameters:
keyPrefix - the key prefix used to filter results
Returns:
a map of all sub properties starting with the specified key prefix.
See Also:
getSubProperties(PropertySources, RelaxedNames), getSubProperties(PropertySources, String, RelaxedNames)

getSubProperties

public static Map<String,Object> getSubProperties(org.springframework.core.env.PropertySources propertySources,
                                                  RelaxedNames keyPrefix)
Return a Map of all values from the specified PropertySources that start with a particular key.

Parameters:
propertySources - the property sources to scan
keyPrefix - the key prefixes to test
Returns:
a map of all sub properties starting with the specified key prefixes.
See Also:
getSubProperties(PropertySources, String, RelaxedNames)

getSubProperties

public static Map<String,Object> getSubProperties(org.springframework.core.env.PropertySources propertySources,
                                                  String rootPrefix,
                                                  RelaxedNames keyPrefix)
Return a Map of all values from the specified PropertySources that start with a particular key.

Parameters:
propertySources - the property sources to scan
rootPrefix - a root prefix to be prepended to the keyPrefex (can be null)
keyPrefix - the key prefixes to test
Returns:
a map of all sub properties starting with the specified key prefixes.
See Also:
getSubProperties(PropertySources, String, RelaxedNames)


Copyright © 2013. All Rights Reserved.