public class RegexStringTransformer extends Object implements Transformer<String>
matching a given regular expression
Pattern and if it partially matches replacing the match(es) with a given replacement.| Modifier and Type | Field and Description |
|---|---|
private Pattern |
pattern |
private boolean |
replaceAll |
private String |
replacement |
| Constructor and Description |
|---|
RegexStringTransformer()
The non-arg constructor.
|
RegexStringTransformer(Pattern pattern,
String replacement,
boolean replaceAll)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Pattern |
getPattern() |
String |
getReplacement() |
boolean |
isReplaceAll() |
String |
transform(String original)
This method transforms a given
original value. |
private Pattern pattern
private String replacement
private boolean replaceAll
public RegexStringTransformer()
public RegexStringTransformer(Pattern pattern, String replacement, boolean replaceAll)
pattern - is the pattern used for conversion.replacement - is the replacement to fill in the string to convert.replaceAll - - if true Matcher.replaceAll(String) will be used, else if false
Matcher.replaceFirst(String).public Pattern getPattern()
public boolean isReplaceAll()
public String getReplacement()
public String transform(String original)
Transformeroriginal value. This value must NOT be modified by this method. To change
the original value a new value has to be created and returned instead. If the value should NOT be changed,
the original value (the exact same instance) should be returned.transform in interface Transformer<String>original - is the original value.null if explicitly documented by the implementation. The
receiver of a Transformer should also document if null is a legal result.Copyright © 2001–2016 mmm-Team. All rights reserved.