org.kuali.common.util.spring
Class PropertySourceUtils

java.lang.Object
  extended by org.kuali.common.util.spring.PropertySourceUtils

public class PropertySourceUtils
extends Object


Constructor Summary
PropertySourceUtils()
           
 
Method Summary
static List<org.springframework.core.env.EnumerablePropertySource<?>> asEnumerableList(List<org.springframework.core.env.PropertySource<?>> sources)
          Create an EnumerablePropertySource list from a PropertySource list
static List<org.springframework.core.env.PropertySource<?>> asList(org.springframework.core.env.PropertySource<?>... sources)
          Null safe conversion of PropertySource[] into List<PropertySource<?>>
static Properties convert(org.springframework.core.env.EnumerablePropertySource<?> source)
          Copy the key/value pairs from source into a java.util.Properties object.
static Properties convert(List<org.springframework.core.env.EnumerablePropertySource<?>> sources)
          Copy the key/value pairs from sources into a java.util.Properties object.
static List<org.springframework.core.env.PropertySource<?>> extractPropertySourcesAndClose(org.springframework.context.ConfigurableApplicationContext context)
           
static Properties getAllEnumerableProperties(org.springframework.core.env.ConfigurableEnvironment env)
          Aggregate every property from every PropertySource in the ConfigurableEnvironment into a Properties object.
static ImmutableProperties getEnvAsImmutableProperties(org.springframework.core.env.ConfigurableEnvironment env)
          Aggregate every property from every PropertySource in the ConfigurableEnvironment into an Properties object.
static org.springframework.core.env.PropertySource<?> getPropertySource(PropertiesService service, List<Location> locations)
           
static List<org.springframework.core.env.PropertySource<?>> getPropertySources(Class<?> annotatedClass)
           
static List<org.springframework.core.env.PropertySource<?>> getPropertySources(org.springframework.context.ConfigurableApplicationContext context)
          Return all PropertySource beans registered in the context, sorted by name.
static List<org.springframework.core.env.PropertySource<?>> getPropertySources(org.springframework.context.ConfigurableApplicationContext context, Comparator<org.springframework.core.env.PropertySource<?>> comparator)
          Return all PropertySource beans registered in the context, sorted use comparator
static List<org.springframework.core.env.PropertySource<?>> getPropertySources(org.springframework.core.env.ConfigurableEnvironment env)
          Aggregate all PropertySource objects from the environment into a List
static SpringContext getSinglePropertySourceContext(org.springframework.core.env.PropertySource<?> source)
          Return a SpringContext such that source is the only thing Spring uses to resolve placeholders
static void reconfigurePropertySources(org.springframework.core.env.ConfigurableEnvironment env, String name, Properties properties)
          Remove all property sources from env and replace them with a single PropertiesPropertySource backed by properties
static void removeAllPropertySources(org.springframework.core.env.ConfigurableEnvironment env)
          Remove all property sources from env.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertySourceUtils

public PropertySourceUtils()
Method Detail

getPropertySource

public static org.springframework.core.env.PropertySource<?> getPropertySource(PropertiesService service,
                                                                               List<Location> locations)

getAllEnumerableProperties

public static Properties getAllEnumerableProperties(org.springframework.core.env.ConfigurableEnvironment env)
Aggregate every property from every PropertySource in the ConfigurableEnvironment into a Properties object.

Throws:
IllegalArgumentException - If any PropertySource is not an EnumerablePropertySource or if any values are not java.lang.String

getEnvAsImmutableProperties

public static ImmutableProperties getEnvAsImmutableProperties(org.springframework.core.env.ConfigurableEnvironment env)
Aggregate every property from every PropertySource in the ConfigurableEnvironment into an Properties object.

Throws:
IllegalArgumentException - If any PropertySource is not an EnumerablePropertySource or if any values are not java.lang.String

asEnumerableList

public static List<org.springframework.core.env.EnumerablePropertySource<?>> asEnumerableList(List<org.springframework.core.env.PropertySource<?>> sources)
Create an EnumerablePropertySource list from a PropertySource list

Throws:
IllegalArgumentException - if any element in sources is not an EnumerablePropertySource

getPropertySources

public static List<org.springframework.core.env.PropertySource<?>> getPropertySources(Class<?> annotatedClass)

extractPropertySourcesAndClose

public static List<org.springframework.core.env.PropertySource<?>> extractPropertySourcesAndClose(org.springframework.context.ConfigurableApplicationContext context)

convert

public static Properties convert(org.springframework.core.env.EnumerablePropertySource<?> source)
Copy the key/value pairs from source into a java.util.Properties object.

Throws:
IllegalArgumentException - if any value is null or is not a java.lang.String

convert

public static Properties convert(List<org.springframework.core.env.EnumerablePropertySource<?>> sources)
Copy the key/value pairs from sources into a java.util.Properties object.

Throws:
IllegalArgumentException - if any value is null or is not a java.lang.String

getPropertySources

public static List<org.springframework.core.env.PropertySource<?>> getPropertySources(org.springframework.core.env.ConfigurableEnvironment env)
Aggregate all PropertySource objects from the environment into a List


reconfigurePropertySources

public static void reconfigurePropertySources(org.springframework.core.env.ConfigurableEnvironment env,
                                              String name,
                                              Properties properties)
Remove all property sources from env and replace them with a single PropertiesPropertySource backed by properties


removeAllPropertySources

public static void removeAllPropertySources(org.springframework.core.env.ConfigurableEnvironment env)
Remove all property sources from env.


asList

public static List<org.springframework.core.env.PropertySource<?>> asList(org.springframework.core.env.PropertySource<?>... sources)
Null safe conversion of PropertySource[] into List<PropertySource<?>>


getPropertySources

public static List<org.springframework.core.env.PropertySource<?>> getPropertySources(org.springframework.context.ConfigurableApplicationContext context,
                                                                                      Comparator<org.springframework.core.env.PropertySource<?>> comparator)
Return all PropertySource beans registered in the context, sorted use comparator


getPropertySources

public static List<org.springframework.core.env.PropertySource<?>> getPropertySources(org.springframework.context.ConfigurableApplicationContext context)
Return all PropertySource beans registered in the context, sorted by name.


getSinglePropertySourceContext

public static SpringContext getSinglePropertySourceContext(org.springframework.core.env.PropertySource<?> source)
Return a SpringContext such that source is the only thing Spring uses to resolve placeholders



Copyright © 2010-2013 The Kuali Foundation. All Rights Reserved.