org.schmant.support.text
Class CapturingGroupAwareStringTextStrategy
java.lang.Object
org.schmant.support.text.CapturingGroupAwareStringTextStrategy
- All Implemented Interfaces:
- ReplacementTextStrategy
public final class CapturingGroupAwareStringTextStrategy
- extends Object
- implements ReplacementTextStrategy
Replacer that use a constant string for replacement.
It is aware of capturing groups in the matched text. Any string \\n where n
is a number in the replacement string will be replaced by the value of that
capturing group.
- Since:
- 0.5
- Author:
- Karl Gustafsson
- See Also:
StringTextStrategy
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CapturingGroupAwareStringTextStrategy
public CapturingGroupAwareStringTextStrategy(String s)
getReplace
public String getReplace(String s,
Matcher m)
- Description copied from interface:
ReplacementTextStrategy
- Get the replacement text for the supplied text.
- Specified by:
getReplace
in interface ReplacementTextStrategy
- Parameters:
s
- The text.m
- The Matcher
that matches the current text. This object
can only be read from. Its state must not be updated.
- Returns:
- The replacement text.