Package com.nomagic.text.builders
Class AbstractTextBuilder<T extends AbstractTextBuilder>
java.lang.Object
com.nomagic.text.builders.AbstractTextBuilder<T>
- All Implemented Interfaces:
TextBuilder<T>
- Direct Known Subclasses:
HtmlTextBuilder
,PlainOrFullHtmlTextBuilder
,PlainOrLightHtmlTextBuilder
,PlainTextBuilder
,RichTextBuilder
@OpenApiAll
public abstract class AbstractTextBuilder<T extends AbstractTextBuilder>
extends Object
implements TextBuilder<T>
Abstract builder.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionappend
(CharSequence text) Append given textprotected String
appendColor
(String text) protected final void
appendToText
(String text) boolean
prepend
(CharSequence text) Add given text to the beginning.protected String
prependColor
(String text) protected final void
prependToText
(String text) protected final void
replaceText
(String text) void
setText
(CharSequence text) Replace current text with the given oneprotected final int
protected String
toAppendableText
(String text) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.nomagic.text.builders.TextBuilder
append, appendWithNoWrap, appendWithSpace, appendWithSpace, compress, isColorSupported, isPlainTextEmpty, prepend, prependWithNoWrap, setColor, setText, toPlainText
-
Constructor Details
-
AbstractTextBuilder
public AbstractTextBuilder()
-
-
Method Details
-
isTextAdded
public boolean isTextAdded()- Specified by:
isTextAdded
in interfaceTextBuilder<T extends AbstractTextBuilder>
- Returns:
- true if at least one text fragment was added (even if fragment is empty)
-
append
Description copied from interface:TextBuilder
Append given text- Specified by:
append
in interfaceTextBuilder<T extends AbstractTextBuilder>
- Parameters:
text
- text to append- Returns:
- this builder
-
prepend
Description copied from interface:TextBuilder
Add given text to the beginning.- Specified by:
prepend
in interfaceTextBuilder<T extends AbstractTextBuilder>
- Parameters:
text
- text to append- Returns:
- this builder
-
appendColor
-
prependColor
-
setText
Description copied from interface:TextBuilder
Replace current text with the given one- Specified by:
setText
in interfaceTextBuilder<T extends AbstractTextBuilder>
- Parameters:
text
- text
-
toString
- Specified by:
toString
in interfaceTextBuilder<T extends AbstractTextBuilder>
- Overrides:
toString
in classObject
- Returns:
- result string
-
appendToText
-
prependToText
-
textLength
protected final int textLength() -
replaceText
-
toAppendableText
-