Interface ASTPattern
-
- All Superinterfaces:
GenericNode<JavaNode>
,JavaNode
,JjtreeNode<JavaNode>
,Node
,Reportable
,TextAvailableNode
- All Known Implementing Classes:
ASTRecordPattern
,ASTTypePattern
,ASTUnnamedPattern
public interface ASTPattern extends JavaNode
A pattern for pattern matching constructs likeInstanceOfExpression
or within aASTSwitchLabel
). This is a JDK 16 feature. TheASTRecordPattern
is a JDK 21 feature.This interface is implemented by all forms of patterns.
Pattern ::= TypePattern | RecordPattern
- See Also:
- JEP 394: Pattern Matching for instanceof (Java 16), JEP 405: Record Patterns (Preview) (Java 19), JEP 432: Record Patterns (Second Preview) (Java 20), JEP 440: Record Patterns (Java 21)
-
-
Field Summary
-
Fields inherited from interface net.sourceforge.pmd.lang.ast.Node
COORDS_COMPARATOR
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description int
getParenthesisDepth()
Deprecated.Parenthesized patterns are only possible with Java 20 Preview and are removed with Java 21.-
Methods inherited from interface net.sourceforge.pmd.lang.ast.impl.GenericNode
ancestors, ancestorsOrSelf, asStream, children, descendants, descendantsOrSelf, getChild, getFirstChild, getLastChild, getNextSibling, getNthParent, getParent, getPreviousSibling
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.JavaNode
getEnclosingType, getRoot, getSymbolTable, getTypeSystem, jjtAccept
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeNode
getFirstToken, getLastToken, tokens
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.Node
acceptVisitor, ancestors, children, compareLocation, descendants, findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, firstChild, getAstInfo, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfType, getImage, getIndexInParent, getLanguageVersion, getNumChildren, getParentsOfType, getReportLocation, getTextDocument, getUserMap, getXPathAttributesIterator, getXPathNodeName, hasDescendantOfType, hasImageEqualTo, isFindBoundary
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.TextAvailableNode
getOriginalText, getText, getTextRegion
-
-
-
-
Method Detail
-
getParenthesisDepth
@Experimental @Deprecated int getParenthesisDepth()
Deprecated.Parenthesized patterns are only possible with Java 20 Preview and are removed with Java 21.Returns the number of parenthesis levels around this pattern. If this method returns 0, then no parentheses are present.
-
-