Class TextElement
- java.lang.Object
-
- com.github.javaparser.printer.lexicalpreservation.TextElement
-
- All Implemented Interfaces:
PrintableTextElement,TextElementMatcher
- Direct Known Subclasses:
ChildTextElement,TokenTextElement
public abstract class TextElement extends java.lang.Object implements TextElementMatcher, PrintableTextElement
-
-
Constructor Summary
Constructors Constructor Description TextElement()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract java.lang.Stringexpand()(package private) abstract java.util.Optional<Range>getRange()booleanisChild()abstract booleanisChildOfClass(java.lang.Class<? extends Node> nodeClass)Is this TextElement representing a child of the given class?abstract booleanisComment()(package private) booleanisCommentToken()abstract booleanisIdentifier()abstract booleanisKeyword()abstract booleanisLiteral()abstract booleanisNewline()(package private) abstract booleanisNode(Node node)abstract booleanisPrimitive()abstract booleanisSeparator()abstract booleanisSpaceOrTab()(package private) abstract booleanisToken(int tokenKind)abstract booleanisWhiteSpace()booleanisWhiteSpaceOrComment()booleanmatch(TextElement textElement)(package private) TextElementMatchermatchByRange()Creates aTextElementMatcherthat matches any TextElement with the same range as this TextElement.
This can be used to curry another TextElementMatcher.
e.g.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.printer.lexicalpreservation.PrintableTextElement
accept
-
Methods inherited from interface com.github.javaparser.printer.lexicalpreservation.TextElementMatcher
and
-
-
-
-
Method Detail
-
expand
abstract java.lang.String expand()
-
isToken
abstract boolean isToken(int tokenKind)
-
isCommentToken
final boolean isCommentToken()
-
match
public boolean match(TextElement textElement)
- Specified by:
matchin interfaceTextElementMatcher
-
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(java.lang.Class<? extends Node> nodeClass)
Is this TextElement representing a child of the given class?
-
isChild
public boolean isChild()
-
getRange
abstract java.util.Optional<Range> getRange()
-
matchByRange
TextElementMatcher matchByRange()
Creates aTextElementMatcherthat 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
-
-