public class

MutablePropertySources

extends Object
implements PropertySources
java.lang.Object
   ↳ org.springframework.core.env.MutablePropertySources

Class Overview

Default implementation of the PropertySources interface. Allows manipulation of contained property sources and provides constructor to copying an existing PropertySources instance.

Where precedence is mentioned in methods such as addFirst(PropertySource) and addLast(PropertySource), this is with regard to the order in which property sources will be searched when resolving a given property with a PropertyResolver.

Summary

Public Constructors
MutablePropertySources()
Create a new MutablePropertySources object.
MutablePropertySources(PropertySources propertySources)
Create a new MutablePropertySources from the given propertySources object, preserving the original order of contained PropertySource objects.
Public Methods
void addAfter(String relativePropertySourceName, PropertySource<?> propertySource)
Add the given property source object with precedence immediately lower than than the named relative property source.
void addBefore(String relativePropertySourceName, PropertySource<?> propertySource)
Add the given property source object with precedence immediately higher than the named relative property source.
void addFirst(PropertySource<?> propertySource)
Add the given property source object with highest precedence.
void addLast(PropertySource<?> propertySource)
Add the given property source object with lowest precedence.
boolean contains(String name)
Return whether a property source with the given name is contained.
PropertySource<?> get(String name)
Return the property source with the given name, null if not found.
Iterator<PropertySource<?>> iterator()
int precedenceOf(PropertySource<?> propertySource)
Return the precedence of the given property source, -1 if not found.
PropertySource<?> remove(String name)
Remove and return the property source with the given name, null if not found.
void replace(String name, PropertySource<?> propertySource)
Replace the property source with the given name with the given property source object.
int size()
Return the number of PropertySource objects contained.
Protected Methods
void assertLegalRelativeAddition(String relativePropertySourceName, PropertySource<?> propertySource)
Ensure that the given property source is not being added relative to itself.
void removeIfPresent(PropertySource<?> propertySource)
Log the removal of the given propertySource if it is present.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.Iterable
From interface org.springframework.core.env.PropertySources

Public Constructors

public MutablePropertySources ()

Also: SpringCore

Create a new MutablePropertySources object.

public MutablePropertySources (PropertySources propertySources)

Also: SpringCore

Create a new MutablePropertySources from the given propertySources object, preserving the original order of contained PropertySource objects.

Public Methods

public void addAfter (String relativePropertySourceName, PropertySource<?> propertySource)

Also: SpringCore

Add the given property source object with precedence immediately lower than than the named relative property source.

public void addBefore (String relativePropertySourceName, PropertySource<?> propertySource)

Also: SpringCore

Add the given property source object with precedence immediately higher than the named relative property source.

public void addFirst (PropertySource<?> propertySource)

Also: SpringCore

Add the given property source object with highest precedence.

public void addLast (PropertySource<?> propertySource)

Also: SpringCore

Add the given property source object with lowest precedence.

public boolean contains (String name)

Also: SpringCore

Return whether a property source with the given name is contained.

Parameters
name the name of the property source to find

public PropertySource<?> get (String name)

Also: SpringCore

Return the property source with the given name, null if not found.

Parameters
name the name of the property source to find

public Iterator<PropertySource<?>> iterator ()

Also: SpringCore

public int precedenceOf (PropertySource<?> propertySource)

Also: SpringCore

Return the precedence of the given property source, -1 if not found.

public PropertySource<?> remove (String name)

Also: SpringCore

Remove and return the property source with the given name, null if not found.

Parameters
name the name of the property source to find and remove

public void replace (String name, PropertySource<?> propertySource)

Also: SpringCore

Replace the property source with the given name with the given property source object.

Parameters
name the name of the property source to find and replace
propertySource the replacement property source
Throws
IllegalArgumentException if no property source with the given name is present
See Also

public int size ()

Also: SpringCore

Return the number of PropertySource objects contained.

Protected Methods

protected void assertLegalRelativeAddition (String relativePropertySourceName, PropertySource<?> propertySource)

Also: SpringCore

Ensure that the given property source is not being added relative to itself.

protected void removeIfPresent (PropertySource<?> propertySource)

Also: SpringCore

Log the removal of the given propertySource if it is present.