Interface StringVisitable.StyledVisitor<T>

Enclosing interface:
StringVisitable

@Environment(CLIENT)
public static interface StringVisitable.StyledVisitor<T>
A visitor for string content and a contextual Style.
  • Method Summary

    Modifier and Type Method Description
    Optional<T> accept​(Style style, String asString)
    Visits a string's content with a contextual style.
  • Method Details

    • accept

      Optional<T> accept​(Style style, String asString)
      Visits a string's content with a contextual style.

      A contextual style is obtained by calling Style.withParent(Style) on the current's text style, passing the previous contextual style or the starting style if it is the beginning of a visit.

      When a present optional is returned, the visit is terminated before visiting all text. Can return StringVisitable.TERMINATE_VISIT for convenience.

      Parameters:
      style - the current style
      asString - the literal string
      Returns:
      Optional.empty() to continue, a non-empty result to terminate