|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.umber.catalan.transform.BaseNodeProcessor org.umber.catalan.transform.text.TextProcessor org.umber.catalan.transform.text.TextReplacer
A text processor which performs a simple search and replace action. Each TextReplacer instance will only handle a single static text replacement, but might replace it multiple times in the same text node. Thus, to change all instances of "pre" to "post" and all instances of "before" to "after", you would have to create two separate TextReplacer objects. This processor accepts only String input, and produces only String output.
Constructor Summary | |
TextReplacer(Datum xml)
Creates a new instance of TextReplacer from the XML spec. |
|
TextReplacer(java.lang.String searchText,
java.lang.String replaceText)
Creates a new instance of TextReplacer. |
Method Summary | |
protected java.util.List |
processText(java.lang.String text)
Processes the text node. |
void |
setReplaceCount(int count)
Assigns the maximum number of times per node that the processor will replace text. |
java.lang.String |
toString()
Convert this object to a String value. |
Methods inherited from class org.umber.catalan.transform.text.TextProcessor |
processNode |
Methods inherited from class org.umber.catalan.transform.BaseNodeProcessor |
addLeftover, end, getLeftovers, getNodes, start |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public TextReplacer(Datum xml)
xml
- XML initializing specpublic TextReplacer(java.lang.String searchText, java.lang.String replaceText)
searchText
- text to search for in the inputreplaceText
- text to replace in the outputMethod Detail |
protected java.util.List processText(java.lang.String text)
processText
in class TextProcessor
text
- the text to process
public void setReplaceCount(int count)
2
. Set to Integer.MAX_VALUE
by default.
count
- the maximum number of occurrences to replacepublic java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |