Example usage for org.springframework.core.env PropertySource named

List of usage examples for org.springframework.core.env PropertySource named

Introduction

In this page you can find the example usage for org.springframework.core.env PropertySource named.

Prototype

public static PropertySource<?> named(String name) 

Source Link

Document

Return a PropertySource implementation intended for collection comparison purposes only.

Usage

From source file:org.springframework.core.env.MutablePropertySources.java

@Override
public boolean contains(String name) {
    return this.propertySourceList.contains(PropertySource.named(name));
}

From source file:org.springframework.core.env.MutablePropertySources.java

@Override
@Nullable/*w w  w  . ja  v a 2  s .  com*/
public PropertySource<?> get(String name) {
    int index = this.propertySourceList.indexOf(PropertySource.named(name));
    return (index != -1 ? this.propertySourceList.get(index) : null);
}

From source file:org.springframework.core.env.MutablePropertySources.java

/**
 * Remove and return the property source with the given name, {@code null} if not found.
 * @param name the name of the property source to find and remove
 *//*from   www  . j a  v  a  2  s.  c  o m*/
@Nullable
public PropertySource<?> remove(String name) {
    if (logger.isDebugEnabled()) {
        logger.debug("Removing PropertySource '" + name + "'");
    }
    int index = this.propertySourceList.indexOf(PropertySource.named(name));
    return (index != -1 ? this.propertySourceList.remove(index) : null);
}

From source file:org.springframework.core.env.MutablePropertySources.java

/**
 * Assert that the named property source is present and return its index.
 * @param name {@linkplain PropertySource#getName() name of the property source} to find
 * @throws IllegalArgumentException if the named property source is not present
 *//*www .j a v a  2s .  c  o m*/
private int assertPresentAndGetIndex(String name) {
    int index = this.propertySourceList.indexOf(PropertySource.named(name));
    if (index == -1) {
        throw new IllegalArgumentException("PropertySource named '" + name + "' does not exist");
    }
    return index;
}