public class TextElement extends Object implements BlockElement, InlineElement
Description.| 限定符和类型 | 类和说明 |
|---|---|
static class |
TextElement.TextStyle
Styles that can be applied to
TextElement e.g. code, bold etc. |
| 限定符和类型 | 方法和说明 |
|---|---|
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
InlineElements 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)
InlineElements 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.