public class InterpolationUtils extends Object
This utility class provides features to replace texts containing variables
by looking up values from the platform ContainerConfiguration
.
Modifier and Type | Field and Description |
---|---|
static char |
DEFAULT_ESCAPE
Default escape character to override the default escape character of
StringSubstitutor , '$'. |
Modifier and Type | Method and Description |
---|---|
static String |
interpolate(ContainerConfiguration containerConfiguration,
String text,
String variablePrefix,
String variableSuffix,
Character escapeChar)
Replaces the given text by looking up values from the given container configuration.
|
static String |
interpolate(String text)
Replaces the given text by looking up values from the platform configuration.
|
static String |
interpolate(org.apache.commons.text.lookup.StringLookup strLookup,
String text,
String variablePrefix,
String variableSuffix,
Character escapeChar)
Replaces the given text by looking up values from the given
StringLookup . |
static String |
interpolate(String text,
String variablePrefix,
String variableSuffix,
Character escapeChar)
Replaces the given text by looking up values from the platform configuration.
|
public static final char DEFAULT_ESCAPE
StringSubstitutor
, '$'.
'\\' is more user friendly than '$' in most use cases.public static String interpolate(String text)
text
- text to replacevariablePrefix
- variable reference prefix. "${" by default.variableSuffix
- variable reference suffix. "}" by default.escapeChar
- escape character which can be put just before a variable reference to ignore the expression.public static String interpolate(String text, String variablePrefix, String variableSuffix, Character escapeChar)
text
- text to replacevariablePrefix
- variable reference prefix. "${" by default.variableSuffix
- variable reference suffix. "}" by default.escapeChar
- escape character which can be put just before a variable reference to ignore the expression.public static String interpolate(ContainerConfiguration containerConfiguration, String text, String variablePrefix, String variableSuffix, Character escapeChar)
containerConfiguration
- platform configurationtext
- text to replacevariablePrefix
- variable reference prefix. "${" by default.variableSuffix
- variable reference suffix. "}" by default.escapeChar
- escape character which can be put just before a variable reference to ignore the expression.public static String interpolate(org.apache.commons.text.lookup.StringLookup strLookup, String text, String variablePrefix, String variableSuffix, Character escapeChar)
StringLookup
.strLookup
- string lookuptext
- text to replacevariablePrefix
- variable reference prefix. "${" by default.variableSuffix
- variable reference suffix. "}" by default.escapeChar
- escape character which can be put just before a variable reference to ignore the expression.Copyright © 2007–2025 Bloomreach. All rights reserved.