public class TextElement extends Object implements BlockElement, InlineElement
Description
.Modifier and Type | Class and Description |
---|---|
static class |
TextElement.TextStyle
Styles that can be applied to
TextElement e.g. |
Modifier and Type | Method and Description |
---|---|
static TextElement |
code(String text)
Creates a block of text formatted as code.
|
void |
format(Formatter formatter)
Transforms itself into String representation using given format.
|
List<InlineElement> |
getElements() |
String |
getFormat() |
EnumSet<TextElement.TextStyle> |
getStyles() |
static TextElement |
text(String text)
Creates a simple block of text.
|
static TextElement |
text(String format,
InlineElement... elements)
Creates a block of text with placeholders ("%s") that will be replaced with proper string
representation of given
InlineElement . |
static InlineElement |
wrap(InlineElement... elements)
Wraps a list of
InlineElement s into a single TextElement . |
public static TextElement text(String format, InlineElement... elements)
InlineElement
. For example:
text("This is a text with a link %s", link("https://somepage", "to here"))
format
- text with placeholders for elementselements
- elements to be put in the textpublic static TextElement text(String text)
text
- a simple block of textpublic static InlineElement wrap(InlineElement... elements)
InlineElement
s into a single TextElement
.public static TextElement code(String text)
text
- a block of text that will be formatted as codepublic String getFormat()
public List<InlineElement> getElements()
public EnumSet<TextElement.TextStyle> getStyles()
public void format(Formatter formatter)
formatter
- formatter to use.Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.