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 Object
implements TextElementMatcher, PrintableTextElement
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) abstract String
expand()
getRange()
boolean
isChild()
abstract boolean
isChildOfClass
(Class<? extends Node> nodeClass) Is this TextElement representing a child of the given class?abstract boolean
(package private) final boolean
abstract boolean
abstract boolean
abstract boolean
abstract boolean
(package private) abstract boolean
abstract boolean
abstract boolean
abstract boolean
(package private) abstract boolean
isToken
(int tokenKind) abstract boolean
final boolean
boolean
match
(TextElement textElement) (package private) TextElementMatcher
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.PrintableTextElement
accept
Methods inherited from interface com.github.javaparser.printer.lexicalpreservation.TextElementMatcher
and
-
Constructor Details
-
TextElement
public TextElement()
-
-
Method Details
-
expand
-
isToken
abstract boolean isToken(int tokenKind) -
isCommentToken
final boolean isCommentToken() -
match
- Specified by:
match
in interfaceTextElementMatcher
-
isNode
-
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
Is this TextElement representing a child of the given class? -
isChild
public boolean isChild() -
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
-