public enum PropertyReplacer extends Enum<PropertyReplacer>
The class provides methods to replace tokens in the format ${property}
within strings,
with the corresponding property values from system properties or a given Properties
object.
Modifier and Type | Method and Description |
---|---|
static String |
replaceTokensWithProperties(String expression)
Replaces tokens of the format
${property} in the given expression with their corresponding
system property values. |
static String |
replaceTokensWithProperties(String expression,
Properties properties)
Replaces tokens of the format
${property} in the given expression with their corresponding
values from the provided Properties object. |
static PropertyReplacer |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static PropertyReplacer[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static PropertyReplacer[] values()
for (PropertyReplacer c : PropertyReplacer.values()) System.out.println(c);
public static PropertyReplacer valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static String replaceTokensWithProperties(String expression) throws IllegalArgumentException
${property}
in the given expression with their corresponding
system property values.expression
- the input string containing tokens to be replaced.IllegalArgumentException
- if a token does not have a corresponding system property.public static String replaceTokensWithProperties(String expression, Properties properties) throws IllegalArgumentException
${property}
in the given expression with their corresponding
values from the provided Properties
object.expression
- the input string containing tokens to be replaced.properties
- the Properties object to retrieve property values from.IllegalArgumentException
- if a token does not have a corresponding property in the given Properties object.Copyright © 2023. All rights reserved.