public final class StringPropertyReplacer extends Object
NOTE: Copied from jboss-common-core.jar
Constructor and Description |
---|
StringPropertyReplacer() |
Modifier and Type | Method and Description |
---|---|
static String |
replaceProperties(String string)
Go through the input string and replace any occurrence of ${p} with
the System.getProtocolProperty(p) value.
|
static String |
replaceProperties(String string,
Properties props)
Go through the input string and replace any occurrence of ${p} with
the props.getProtocolProperty(p) value.
|
public static String replaceProperties(String string)
If the property reference is of the form ${p:v} and there is no such property p, then the default value v will be returned.
If the property reference is of the form ${p1,p2} or ${p1,p2:v} then the primary and the secondary properties will be tried in turn, before returning either the unchanged input, or the default value.
The property ${/} is replaced with System.getProtocolProperty("file.separator") value and the property ${:} is replaced with System.getProtocolProperty("path.separator").
Prior to resolving variables, environment variables are assigned to the collection of properties. Each environment variable is prefixed with the prefix "env.". If a system property is already defined for the prefixed environment variable, the system property is honored as an override (primarily for testing).
string
- - the string with possible ${} referencespublic static String replaceProperties(String string, Properties props)
If the property reference is of the form ${p:v} and there is no such property p, then the default value v will be returned.
If the property reference is of the form ${p1,p2} or ${p1,p2:v} then the primary and the secondary properties will be tried in turn, before returning either the unchanged input, or the default value.
The property ${/} is replaced with System.getProtocolProperty("file.separator") value and the property ${:} is replaced with System.getProtocolProperty("path.separator").
string
- - the string with possible ${} referencesprops
- - the source for ${x} property ref values, null means use System.getProtocolProperty()Copyright © 2018 JBoss by Red Hat. All rights reserved.