Class TextElement
- java.lang.Object
-
- com.github.javaparser.printer.lexicalpreservation.TextElement
-
- All Implemented Interfaces:
TextElementMatcher
- Direct Known Subclasses:
ChildTextElement
,TokenTextElement
public abstract class TextElement extends java.lang.Object implements TextElementMatcher
-
-
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.String
expand()
(package private) abstract java.util.Optional<Range>
getRange()
boolean
isChild()
abstract boolean
isChildOfClass(java.lang.Class<? extends Node> nodeClass)
Is this TextElement representing a child of the given class?abstract boolean
isComment()
(package private) boolean
isCommentToken()
abstract boolean
isIdentifier()
abstract boolean
isKeyword()
abstract boolean
isLiteral()
abstract boolean
isNewline()
(package private) abstract boolean
isNode(Node node)
abstract boolean
isPrimitive()
abstract boolean
isSeparator()
abstract boolean
isSpaceOrTab()
(package private) abstract boolean
isToken(int tokenKind)
abstract boolean
isWhiteSpace()
boolean
isWhiteSpaceOrComment()
boolean
match(TextElement textElement)
(package private) TextElementMatcher
matchByRange()
Creates aTextElementMatcher
that 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.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:
match
in 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 aTextElementMatcher
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
-
-