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
-
Method Summary
Modifier and TypeMethodDescriptionappend
(CharSequence text) Append given textvoid
appendTo
(TextBuilder builder) Appends text from this builder to the given one.boolean
boolean
prepend
(CharSequence text) Add given text to the beginning.Set color of the text which will be added later.void
setText
(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, wait
Methods 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:TextBuilder
Append given text- Specified by:
append
in interfaceTextBuilder<T extends RawTextBuilder>
- 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 RawTextBuilder>
- Parameters:
text
- text to append- Returns:
- this builder
-
toString
- Specified by:
toString
in interfaceTextBuilder<T extends RawTextBuilder>
- Overrides:
toString
in classObject
- Returns:
- result string
-
setText
Description copied from interface:TextBuilder
Replace current text with the given one- Specified by:
setText
in interfaceTextBuilder<T extends RawTextBuilder>
- Parameters:
text
- text
-
toPlainText
- Specified by:
toPlainText
in interfaceTextBuilder<T extends RawTextBuilder>
- Returns:
- result string as plain text
-
setColor
Description copied from interface:TextBuilder
Set color of the text which will be added later. Not every implementation supports that, so color can be ignored.- Specified by:
setColor
in 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:
isColorSupported
in 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:
isTextAdded
in interfaceTextBuilder<T extends RawTextBuilder>
- Returns:
- true if at least one text fragment was added (even if fragment is empty)
-