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 java.lang.Object implements TextBuilder<T>
Abstract builder.
-
-
Constructor Summary
Constructors Constructor Description AbstractTextBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tappend(java.lang.CharSequence text)Append given textprotected java.lang.StringappendColor(java.lang.String text)protected voidappendToText(java.lang.String text)booleanisTextAdded()Tprepend(java.lang.CharSequence text)Add given text to the beginning.protected java.lang.StringprependColor(java.lang.String text)protected voidprependToText(java.lang.String text)protected voidreplaceText(java.lang.String text)voidsetText(java.lang.CharSequence text)Replace current text with the given oneprotected inttextLength()protected java.lang.StringtoAppendableText(java.lang.String text)java.lang.StringtoString()-
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, compress, isColorSupported, isPlainTextEmpty, prepend, prependWithNoWrap, setColor, setText, toPlainText
-
-
-
-
Method Detail
-
isTextAdded
public boolean isTextAdded()
- Specified by:
isTextAddedin interfaceTextBuilder<T extends AbstractTextBuilder>- Returns:
- true if at least one text fragment was added (even if fragment is empty)
-
append
public T append(java.lang.CharSequence text)
Description copied from interface:TextBuilderAppend given text- Specified by:
appendin interfaceTextBuilder<T extends AbstractTextBuilder>- Parameters:
text- text to append- Returns:
- this builder
-
prepend
public T prepend(java.lang.CharSequence text)
Description copied from interface:TextBuilderAdd given text to the beginning.- Specified by:
prependin interfaceTextBuilder<T extends AbstractTextBuilder>- Parameters:
text- text to append- Returns:
- this builder
-
appendColor
protected java.lang.String appendColor(java.lang.String text)
-
prependColor
protected java.lang.String prependColor(java.lang.String text)
-
setText
public void setText(java.lang.CharSequence text)
Description copied from interface:TextBuilderReplace current text with the given one- Specified by:
setTextin interfaceTextBuilder<T extends AbstractTextBuilder>- Parameters:
text- text
-
toString
public java.lang.String toString()
- Specified by:
toStringin interfaceTextBuilder<T extends AbstractTextBuilder>- Overrides:
toStringin classjava.lang.Object- Returns:
- result string
-
appendToText
protected final void appendToText(java.lang.String text)
-
prependToText
protected final void prependToText(java.lang.String text)
-
textLength
protected final int textLength()
-
replaceText
protected final void replaceText(java.lang.String text)
-
toAppendableText
protected java.lang.String toAppendableText(java.lang.String text)
-
-