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 T
append(java.lang.CharSequence text)
Append given textprotected java.lang.String
appendColor(java.lang.String text)
protected void
appendToText(java.lang.String text)
boolean
isTextAdded()
T
prepend(java.lang.CharSequence text)
Add given text to the beginning.protected java.lang.String
prependColor(java.lang.String text)
protected void
prependToText(java.lang.String text)
protected void
replaceText(java.lang.String text)
void
setText(java.lang.CharSequence text)
Replace current text with the given oneprotected int
textLength()
protected java.lang.String
toAppendableText(java.lang.String text)
java.lang.String
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, compress, isColorSupported, isPlainTextEmpty, prepend, prependWithNoWrap, setColor, setText, toPlainText
-
-
-
-
Method Detail
-
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
public T append(java.lang.CharSequence text)
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
public T prepend(java.lang.CharSequence text)
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
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:TextBuilder
Replace current text with the given one- Specified by:
setText
in interfaceTextBuilder<T extends AbstractTextBuilder>
- Parameters:
text
- text
-
toString
public java.lang.String toString()
- Specified by:
toString
in interfaceTextBuilder<T extends AbstractTextBuilder>
- Overrides:
toString
in 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)
-
-