Class TextBlockLiteralExpr

All Implemented Interfaces:
NodeWithRange<Node>, NodeWithTokenRange<Node>, Observable, Visitable, HasParentNode<Node>, Cloneable

public class TextBlockLiteralExpr extends LiteralStringValueExpr

A text block

Java 13-

A text block is a multi-line string. It was introduced in JEP 355. The content of "value" is byte-for-byte exactly what is in the source code.
  • Constructor Details

    • TextBlockLiteralExpr

      public TextBlockLiteralExpr()
    • TextBlockLiteralExpr

      public TextBlockLiteralExpr(String value)
      Creates a text block literal expression from given string.
      Parameters:
      value - the value of the literal
    • TextBlockLiteralExpr

      public TextBlockLiteralExpr(TokenRange tokenRange, String value)
      This constructor is used by the parser and is considered private.
  • Method Details

    • accept

      public <R,​ A> R accept(GenericVisitor<R,​A> v, A arg)
      Description copied from interface: Visitable
      Accept method for visitor support.
      Type Parameters:
      R - the type of the return value of the visitor
      A - the type the user argument passed to the visitor
      Parameters:
      v - the visitor implementation
      arg - the argument passed to the visitor (of type A)
      Returns:
      the result of the visit (of type R)
    • accept

      public <A> void accept(VoidVisitor<A> v, A arg)
      Description copied from interface: Visitable
      Accept method for visitor support.
      Type Parameters:
      A - the type the argument passed for the visitor
      Parameters:
      v - the visitor implementation
      arg - any value relevant for the visitor (of type A)
    • isTextBlockLiteralExpr

      public boolean isTextBlockLiteralExpr()
      Overrides:
      isTextBlockLiteralExpr in class Expression
    • asTextBlockLiteralExpr

      public TextBlockLiteralExpr asTextBlockLiteralExpr()
      Overrides:
      asTextBlockLiteralExpr in class Expression
    • toTextBlockLiteralExpr

      public Optional<TextBlockLiteralExpr> toTextBlockLiteralExpr()
      Overrides:
      toTextBlockLiteralExpr in class Expression
    • ifTextBlockLiteralExpr

      public void ifTextBlockLiteralExpr(Consumer<TextBlockLiteralExpr> action)
      Overrides:
      ifTextBlockLiteralExpr in class Expression
    • clone

      public TextBlockLiteralExpr clone()
      Overrides:
      clone in class LiteralStringValueExpr
    • getMetaModel

      public TextBlockLiteralExprMetaModel getMetaModel()
      Overrides:
      getMetaModel in class LiteralStringValueExpr
      Returns:
      get JavaParser specific node introspection information.
    • stripIndentOfLines

      public Stream<String> stripIndentOfLines()
      Most of the algorithm for stripIndent, stopping just before concatenating all the lines into a single string. Useful for tools.
    • stripIndent

      public String stripIndent()
      Returns:
      The algorithm from String::stripIndent in JDK 13.
    • translateEscapes

      public String translateEscapes()
      Returns:
      The algorithm from String::translateEscapes in JDK 13.
    • asString

      public String asString()
      Returns:
      the final string value of this text block after all processing.