public class TextReplacement
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
TextReplacement.TextResolver
Used during the TextReplacement to dynamically resolve the input string with a value.
|
Constructor and Description |
---|
TextReplacement(java.util.regex.Pattern pat,
TextReplacement.TextResolver resolver)
Creates a TextReplacement for the given regular expression and resolver.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
doReplacements(java.lang.String in)
For the given input string, like, 'fielda=${val1} and fieldb=${val2}', do the variable replacements
using the regular expression and resolver that was passed in the contructor
|
static TextReplacement |
newColonTextReplacement(TextReplacement.TextResolver resolver)
Creates a
TextReplacement for :VARNAME type of variables |
static TextReplacement |
newDollarTextReplacement(TextReplacement.TextResolver resolver)
Creates a
TextReplacement for ${VARNAME} type of variables |
static TextReplacement |
newMustacheTextReplacement(TextReplacement.TextResolver resolver)
Creates a mustache
TextReplacement for {{opt_prefix:VARNAME:opt_posfix}} type of variables
VARNAME can contain A-Z,0-9,and _ (underscore) |
static TextReplacement |
newPrefixDollarTextReplacement(TextReplacement.TextResolver resolver)
Creates a
TextReplacement for ${opt_prefix:VARNAME:opt_posfix} type of variables
VARNAME can contain A-Z,0-9,and _ (underscore) |
public TextReplacement(java.util.regex.Pattern pat, TextReplacement.TextResolver resolver)
pat
- resolver
- public java.lang.String doReplacements(java.lang.String in)
in
- public static TextReplacement newDollarTextReplacement(TextReplacement.TextResolver resolver)
TextReplacement
for ${VARNAME} type of variablesresolver
- public static TextReplacement newPrefixDollarTextReplacement(TextReplacement.TextResolver resolver)
TextReplacement
for ${opt_prefix:VARNAME:opt_posfix} type of variables
VARNAME can contain A-Z,0-9,and _ (underscore)resolver
- public static TextReplacement newMustacheTextReplacement(TextReplacement.TextResolver resolver)
TextReplacement
for {{opt_prefix:VARNAME:opt_posfix}} type of variables
VARNAME can contain A-Z,0-9,and _ (underscore)resolver
- public static TextReplacement newColonTextReplacement(TextReplacement.TextResolver resolver)
TextReplacement
for :VARNAME type of variablesresolver
-