Interface Annotatable
- All Superinterfaces:
net.sourceforge.pmd.lang.ast.impl.GenericNode<JavaNode>
,JavaNode
,net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeNode<JavaNode>
,net.sourceforge.pmd.lang.ast.Node
,net.sourceforge.pmd.reporting.Reportable
,net.sourceforge.pmd.lang.ast.TextAvailableNode
- All Known Subinterfaces:
ASTExecutableDeclaration
,ASTReferenceType
,ASTType
,ASTTypeDeclaration
,ModifierOwner
- All Known Implementing Classes:
ASTAmbiguousName
,ASTAnnotationTypeDeclaration
,ASTAnonymousClassDeclaration
,ASTArrayDimExpr
,ASTArrayType
,ASTArrayTypeDim
,ASTCatchParameter
,ASTClassDeclaration
,ASTClassType
,ASTCompactConstructorDeclaration
,ASTConstructorDeclaration
,ASTEnumConstant
,ASTEnumDeclaration
,ASTFieldDeclaration
,ASTFormalParameter
,ASTImplicitClassDeclaration
,ASTIntersectionType
,ASTLambdaParameter
,ASTLocalVariableDeclaration
,ASTMethodDeclaration
,ASTModuleDeclaration
,ASTPackageDeclaration
,ASTPrimitiveType
,ASTRecordComponent
,ASTRecordDeclaration
,ASTTypeParameter
,ASTTypePattern
,ASTUnionType
,ASTVariableId
,ASTVoidType
,ASTWildcardType
Marks nodes that can be annotated. Annotations
are most often the first few children of the node they apply to.
E.g. in
@Positive int
, the @Positive
annotation is
a child of the PrimitiveType
node. This
contrasts with PMD 6.0 grammar, where the annotations were most often
the preceding siblings.-
Field Summary
Fields inherited from interface net.sourceforge.pmd.lang.ast.Node
COORDS_COMPARATOR
-
Method Summary
Modifier and TypeMethodDescriptiondefault ASTAnnotation
getAnnotation
(String binaryName) Returns a specific annotation on this node, or null if absent.default net.sourceforge.pmd.lang.ast.NodeStream
<ASTAnnotation> Returns all annotations present on this node.default boolean
isAnnotationPresent
(Class<?> type) Returns true if an annotation with the given type is applied to this node.default boolean
isAnnotationPresent
(String annotQualifiedName) Returns true if an annotation with the given qualified name is applied to this node.default boolean
isAnyAnnotationPresent
(Collection<String> binaryNames) Checks whether any annotation is present on this node.Methods inherited from interface net.sourceforge.pmd.lang.ast.impl.GenericNode
ancestors, ancestorsOrSelf, asStream, children, descendants, descendantsOrSelf, getChild, getFirstChild, getLastChild, getNextSibling, getParent, getPreviousSibling
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.JavaNode
getEnclosingType, getRoot, getSymbolTable, getTypeSystem
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, firstChild, getAstInfo, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getImage, getIndexInParent, getLanguageVersion, getNumChildren, getReportLocation, getTextDocument, getUserMap, getXPathAttributesIterator, getXPathNodeName, hasImageEqualTo, isFindBoundary
Methods inherited from interface net.sourceforge.pmd.lang.ast.TextAvailableNode
getOriginalText, getText, getTextRegion
-
Method Details
-
getDeclaredAnnotations
Returns all annotations present on this node. -
isAnnotationPresent
Returns true if an annotation with the given qualified name is applied to this node.- Parameters:
annotQualifiedName
- Note: for now, canonical names are tolerated, this may be changed in PMD 7.
-
isAnnotationPresent
Returns true if an annotation with the given type is applied to this node. -
getAnnotation
Returns a specific annotation on this node, or null if absent.- Parameters:
binaryName
- Binary name of the annotation type. Note: for now, canonical names are tolerated, this may be changed in PMD 7.
-
isAnyAnnotationPresent
Checks whether any annotation is present on this node.- Parameters:
binaryNames
- Collection that contains binary names of annotations. Note: for now, canonical names are tolerated, this may be changed in PMD 7.- Returns:
true
if any annotation is present on this node, elsefalse
-