public static class Description.DescriptionBuilder extends Object
Description
. Allows adding a rich formatting like lists, links,
linebreaks etc. For example:
Description description = Description.builder()
.text("This is some list: ")
.list(
text("this is first element of list"),
text("this is second element of list with a %s", link("https://link")))
.build();
Constructor and Description |
---|
DescriptionBuilder() |
Modifier and Type | Method and Description |
---|---|
Description.DescriptionBuilder |
add(BlockElement block)
Block of description add.
|
Description |
build()
Creates description representation.
|
Description.DescriptionBuilder |
linebreak()
Creates a line break in the description.
|
Description.DescriptionBuilder |
list(InlineElement... elements)
Adds a bulleted list to the description.
|
Description.DescriptionBuilder |
text(String text)
Creates a simple block of text.
|
Description.DescriptionBuilder |
text(String format,
InlineElement... elements)
Adds a block of text with placeholders ("%s") that will be replaced with proper string
representation of given
InlineElement . |
public Description.DescriptionBuilder 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 Description.DescriptionBuilder text(String text)
text
- a simple block of textpublic Description.DescriptionBuilder add(BlockElement block)
block
- block of description to addpublic Description.DescriptionBuilder linebreak()
public Description.DescriptionBuilder list(InlineElement... elements)
public Description build()
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.