org.schmant.support.text
Class StringTextStrategy

java.lang.Object
  extended by org.schmant.support.text.StringTextStrategy
All Implemented Interfaces:
ReplacementTextStrategy

public class StringTextStrategy
extends Object
implements ReplacementTextStrategy

This ReplacementTextStrategy replaces the matched text with a constant string value.

Since:
0.8
Author:
Karl Gustafsson
See Also:
CapturingGroupAwareStringTextStrategy

Constructor Summary
StringTextStrategy(String replacementString)
          Create a new string text strategy.
 
Method Summary
 String getReplace(String text, Matcher m)
          Get the replacement text for the supplied text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringTextStrategy

public StringTextStrategy(String replacementString)
Create a new string text strategy.

Parameters:
replacementString - The replacement text.
Method Detail

getReplace

public String getReplace(String text,
                         Matcher m)
Description copied from interface: ReplacementTextStrategy
Get the replacement text for the supplied text.

Specified by:
getReplace in interface ReplacementTextStrategy
Parameters:
text - 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.