public interface StringVisitable
Modifier and Type | Interface and Description |
---|---|
static interface |
StringVisitable.StyledVisitor<T>
A visitor for string content and a contextual
Style . |
static interface |
StringVisitable.Visitor<T>
A visitor for string content.
|
Modifier and Type | Field and Description |
---|---|
static StringVisitable |
EMPTY
An empty visitable that does not call the visitors.
|
static Optional<Unit> |
TERMINATE_VISIT
Convenience object indicating the termination of a string visit.
|
Modifier and Type | Method and Description |
---|---|
static StringVisitable |
concat(List<StringVisitable> visitables)
Concats multiple string visitables by the order they appear in the list.
|
static StringVisitable |
concat(StringVisitable[] visitables)
Concats multiple string visitables by the order they appear in the array.
|
default String |
getString() |
static StringVisitable |
plain(String string)
Creates a visitable from a plain string.
|
static StringVisitable |
styled(String string,
Style style)
Creates a visitable from a plain string and a root style.
|
<T> Optional<T> |
visit(StringVisitable.StyledVisitor<T> styledVisitor,
Style style)
Supplies this visitable's literal content and contextual style to
the visitor.
|
<T> Optional<T> |
visit(StringVisitable.Visitor<T> visitor)
Supplies this visitable's literal content to the visitor.
|
static final Optional<Unit> TERMINATE_VISIT
static final StringVisitable EMPTY
<T> Optional<T> visit(StringVisitable.Visitor<T> visitor)
visitor
- the visitorOptional.empty()
if the visit finished, or a terminating
result from the visitor
@Environment(value=CLIENT) <T> Optional<T> visit(StringVisitable.StyledVisitor<T> styledVisitor, Style style)
styledVisitor
- the visitorstyle
- the contextual styleOptional.empty()
if the visit finished, or a terminating
result from the visitor
static StringVisitable plain(String string)
string
- the plain string@Environment(value=CLIENT) static StringVisitable styled(String string, Style style)
string
- the plain stringstyle
- the root style@Environment(value=CLIENT) static StringVisitable concat(StringVisitable[] visitables)
visitables
- an array or varargs of visitables@Environment(value=CLIENT) static StringVisitable concat(List<StringVisitable> visitables)
visitables
- a list of visitablesdefault String getString()