java.lang.Object
com.github.javaparser.printer.lexicalpreservation.TextElement
All Implemented Interfaces:
PrintableTextElement, TextElementMatcher
Direct Known Subclasses:
ChildTextElement, TokenTextElement

public abstract class TextElement extends Object implements TextElementMatcher, PrintableTextElement
  • Constructor Details

    • TextElement

      public TextElement()
  • Method Details

    • expand

      abstract String expand()
    • isToken

      abstract boolean isToken(int tokenKind)
    • isCommentToken

      final boolean isCommentToken()
    • match

      public boolean match(TextElement textElement)
      Specified by:
      match in interface TextElementMatcher
    • isNode

      abstract boolean isNode(Node node)
    • isLiteral

      public abstract boolean isLiteral()
    • isWhiteSpace

      public abstract boolean isWhiteSpace()
    • isSpaceOrTab

      public abstract boolean isSpaceOrTab()
    • isNewline

      public abstract boolean isNewline()
    • isComment

      public abstract boolean isComment()
    • isSeparator

      public abstract boolean isSeparator()
    • isIdentifier

      public abstract boolean isIdentifier()
    • isKeyword

      public abstract boolean isKeyword()
    • isPrimitive

      public abstract boolean isPrimitive()
    • isWhiteSpaceOrComment

      public final boolean isWhiteSpaceOrComment()
    • isChildOfClass

      public abstract boolean isChildOfClass(Class<? extends Node> nodeClass)
      Is this TextElement representing a child of the given class?
    • isChild

      public boolean isChild()
    • getRange

      abstract Optional<Range> getRange()
    • matchByRange

      TextElementMatcher matchByRange()
      Creates a TextElementMatcher that matches any TextElement with the same range as this TextElement.
      This can be used to curry another TextElementMatcher.
      e.g. someTextElementMatcher.and(textElement.matchByRange());
      Returns:
      TextElementMatcher that matches any TextElement with the same Range