Example usage for org.apache.commons.lang.text StrSubstitutor replaceSystemProperties

List of usage examples for org.apache.commons.lang.text StrSubstitutor replaceSystemProperties

Introduction

In this page you can find the example usage for org.apache.commons.lang.text StrSubstitutor replaceSystemProperties.

Prototype

public static String replaceSystemProperties(Object source) 

Source Link

Document

Replaces all the occurrences of variables in the given source object with their matching values from the system properties.

Usage

From source file:org.codice.ddf.configuration.PropertyResolver.java

/**
 * Returns a string with variables replaced by system property values if they exist
 *
 * @return//from w w w .j a va2s.  c om
 */
public static String resolveProperties(String str) {
    return StrSubstitutor.replaceSystemProperties(str);
}

From source file:org.codice.ddf.configuration.PropertyResolver.java

/**
 * Returns a List with variables replaced by system property values if they exist
 *
 * @return//from  w w w.  j  a v  a2 s. co m
 */
public static List<String> resolveProperties(List<String> list) {
    for (final ListIterator<String> i = list.listIterator(); i.hasNext();) {
        final String item = StrSubstitutor.replaceSystemProperties(i.next());
        i.set(item);
    }
    return list;
}

From source file:org.codice.ddf.platform.util.properties.PropertiesLoader.java

/**
 * Replace any ${prop} with system properties.
 *
 * @param props current state of properties that contain placeholders of the form ${property}.
 * @return the given property object with system property placeholders switched to their actual
 *     values./*from  w w  w .java  2  s .  c o  m*/
 */
@VisibleForTesting
static Properties substituteSystemPropertyPlaceholders(Properties props) {
    Properties filtered = new Properties();
    for (Map.Entry<?, ?> entry : props.entrySet()) {
        filtered.put(StrSubstitutor.replaceSystemProperties(entry.getKey()),
                StrSubstitutor.replaceSystemProperties(entry.getValue()));
        StrSubstitutor.replaceSystemProperties(new Object());
    }
    return filtered;
}

From source file:sos.scheduler.misc.ParameterSubstitutor.java

public String replaceSystemProperties(String source) {
    return StrSubstitutor.replaceSystemProperties(source);
}