public abstract class SystemPropertyUtils extends Object
A text may contain $ ...
placeholders, to be resolved as system properties:
e.g. $ user.dir
. Default values can be supplied using the ":" separator
between key and value.
Adapted from Spring.
System.getProperty(String)
Modifier and Type | Field and Description |
---|---|
static String |
PLACEHOLDER_PREFIX
Prefix for system property placeholders: "${"
|
static String |
PLACEHOLDER_SUFFIX
Suffix for system property placeholders: "}"
|
static String |
VALUE_SEPARATOR
Value separator for system property placeholders: ":"
|
Constructor and Description |
---|
SystemPropertyUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
resolvePlaceholders(Properties properties,
String text)
Resolve ${...} placeholders in the given text, replacing them with corresponding
system property values.
|
static String |
resolvePlaceholders(String text)
Resolve ${...} placeholders in the given text, replacing them with corresponding
system property values.
|
public static final String PLACEHOLDER_PREFIX
public static final String PLACEHOLDER_SUFFIX
public static final String VALUE_SEPARATOR
public static String resolvePlaceholders(String text)
text
- the String to resolveIllegalArgumentException
- if there is an unresolvable placeholderPLACEHOLDER_PREFIX
,
PLACEHOLDER_SUFFIX
public static String resolvePlaceholders(Properties properties, String text)
properties
- a properties instance to use in addition to Systemtext
- the String to resolveIllegalArgumentException
- if there is an unresolvable placeholderPLACEHOLDER_PREFIX
,
PLACEHOLDER_SUFFIX
Copyright © 2013. All rights reserved.