Package com.nomagic.text.builders
Class RawTextBuilder<T extends RawTextBuilder>
java.lang.Object
com.nomagic.text.builders.RawTextBuilder<T>
- All Implemented Interfaces:
TextBuilder<T>
@OpenApiAll
public class RawTextBuilder<T extends RawTextBuilder>
extends Object
implements TextBuilder<T>
Builds a text without any transformation - input text is appended to the output text.
Builder does not support colored fragments directly - result text does not have colors. However colors are be supported
if
appendTo(TextBuilder) is used and proper builder is passed.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(CharSequence text) Append given textvoidappendTo(TextBuilder builder) Appends text from this builder to the given one.booleanbooleanprepend(CharSequence text) Add given text to the beginning.Set color of the text which will be added later.voidsetText(CharSequence text) Replace current text with the given onetoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.nomagic.text.builders.TextBuilder
append, appendWithNoWrap, appendWithSpace, appendWithSpace, compress, isPlainTextEmpty, prepend, prependWithNoWrap, setText
-
Constructor Details
-
RawTextBuilder
public RawTextBuilder()
-
-
Method Details
-
append
Description copied from interface:TextBuilderAppend given text- Specified by:
appendin interfaceTextBuilder<T extends RawTextBuilder>- Parameters:
text- text to append- Returns:
- this builder
-
prepend
Description copied from interface:TextBuilderAdd given text to the beginning.- Specified by:
prependin interfaceTextBuilder<T extends RawTextBuilder>- Parameters:
text- text to append- Returns:
- this builder
-
toString
- Specified by:
toStringin interfaceTextBuilder<T extends RawTextBuilder>- Overrides:
toStringin classObject- Returns:
- result string
-
setText
Description copied from interface:TextBuilderReplace current text with the given one- Specified by:
setTextin interfaceTextBuilder<T extends RawTextBuilder>- Parameters:
text- text
-
toPlainText
- Specified by:
toPlainTextin interfaceTextBuilder<T extends RawTextBuilder>- Returns:
- result string as plain text
-
setColor
Description copied from interface:TextBuilderSet color of the text which will be added later. Not every implementation supports that, so color can be ignored.- Specified by:
setColorin interfaceTextBuilder<T extends RawTextBuilder>- Parameters:
color- color to set. Null is used to reset previously set color- Returns:
- this builder
-
isColorSupported
public boolean isColorSupported()- Specified by:
isColorSupportedin interfaceTextBuilder<T extends RawTextBuilder>- Returns:
- true if builder supports color
-
appendTo
Appends text from this builder to the given one.- Parameters:
builder- given builder
-
isTextAdded
public boolean isTextAdded()- Specified by:
isTextAddedin interfaceTextBuilder<T extends RawTextBuilder>- Returns:
- true if at least one text fragment was added (even if fragment is empty)
-