org.kefirsf.bb.TextProcessorChain Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kefirbb Show documentation
Show all versions of kefirbb Show documentation
KefirBB is a Java-library for text processing. Initially it was developed for BB2HTML translation.
But flexible configuration allows to use it in different cases. For example for parsing Markdown, Textile,
and for HTML filtration.
The newest version!
package org.kefirsf.bb;
import java.util.Collections;
import java.util.List;
/**
* Chain of text processors wich process text serially
*
* @author Kefir
*/
public class TextProcessorChain extends TextProcessorAdapter {
/**
* List of processors
*/
private final List extends TextProcessor> processors;
public TextProcessorChain(List extends TextProcessor> processors) {
this.processors = Collections.unmodifiableList(processors);
}
/**
* Process the text
*
* @param source the sourcetext
* @return the result of text processing
* @see TextProcessor#process(CharSequence)
*/
public CharSequence process(CharSequence source) {
CharSequence target = source;
for (TextProcessor processor : processors) {
target = processor.process(target);
}
return target;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy