public class ReplacerChain extends TextReplacer implements Chain<TextReplacer,ReplacerChain>
| Constructor and Description |
|---|
ReplacerChain(TextReplacer... replacers)
构造
|
| Modifier and Type | Method and Description |
|---|---|
ReplacerChain |
addChain(TextReplacer element)
加入责任链
|
Iterator<TextReplacer> |
iterator() |
protected int |
replace(CharSequence text,
int indexes,
TextBuilder builder)
抽象的字符串替换方法,通过传入原字符串和当前位置,执行替换逻辑,返回处理或替换的字符串长度部分。
|
replaceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic ReplacerChain(TextReplacer... replacers)
replacers - 字符串替换器public Iterator<TextReplacer> iterator()
iterator in interface Iterable<TextReplacer>public ReplacerChain addChain(TextReplacer element)
ChainaddChain in interface Chain<TextReplacer,ReplacerChain>element - 责任链新的环节元素protected int replace(CharSequence text, int indexes, TextBuilder builder)
TextReplacerreplace in class TextReplacertext - 被处理的字符串indexes - 当前位置builder - 输出Copyright © 2022. All rights reserved.