Class AbstractAnyTypeDeclaration
- java.lang.Object
-
- net.sourceforge.pmd.lang.ast.AbstractNode
-
- net.sourceforge.pmd.lang.java.ast.AbstractJavaNode
-
- net.sourceforge.pmd.lang.java.ast.AbstractJavaAccessNode
-
- net.sourceforge.pmd.lang.java.ast.AbstractJavaAccessTypeNode
-
- net.sourceforge.pmd.lang.java.ast.AbstractAnyTypeDeclaration
-
- All Implemented Interfaces:
net.sourceforge.pmd.lang.ast.Node
,net.sourceforge.pmd.lang.ast.QualifiableNode
,AccessNode
,Annotatable
,ASTAnyTypeDeclaration
,JavaNode
,JavaQualifiableNode
,TypeNode
,net.sourceforge.pmd.lang.symboltable.ScopedNode
- Direct Known Subclasses:
ASTAnnotationTypeDeclaration
,ASTClassOrInterfaceDeclaration
,ASTEnumDeclaration
public abstract class AbstractAnyTypeDeclaration extends AbstractJavaAccessTypeNode implements ASTAnyTypeDeclaration
Abstract class for type declarations nodes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sourceforge.pmd.lang.java.ast.ASTAnyTypeDeclaration
ASTAnyTypeDeclaration.TypeKind
-
-
Field Summary
-
Fields inherited from class net.sourceforge.pmd.lang.java.ast.AbstractJavaAccessTypeNode
typeDefinition
-
Fields inherited from class net.sourceforge.pmd.lang.java.ast.AbstractJavaNode
parser
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
enclosingTypeIsA(ASTAnyTypeDeclaration.TypeKind... kinds)
Returns true if the enclosing type of this type declaration is any of the given kinds.ASTAnnotation
getAnnotation(java.lang.String annotQualifiedName)
Get specific annotaion on this node.java.util.List<ASTAnnotation>
getDeclaredAnnotations()
Get all annotations present on this node.ASTAnyTypeDeclaration
getEnclosingTypeDeclaration()
Returns the enclosing type of this type, if it is nested.JavaTypeQualifiedName
getQualifiedName()
Returns a qualified name for this node.boolean
isAnnotationPresent(java.lang.String annotQualifiedName)
Checks whether the annotation is present on this node.boolean
isAnyAnnotationPresent(java.util.Collection<java.lang.String> annotQualifiedNames)
Checks whether any annotation is present on this node.boolean
isNested()
Returns true if this type declaration is nested inside an interface, class or annotation.void
setQualifiedName(JavaTypeQualifiedName qualifiedName)
-
Methods inherited from class net.sourceforge.pmd.lang.java.ast.AbstractJavaAccessNode
getModifiers, isAbstract, isDefault, isFinal, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setAbstract, setDefault, setFinal, setModifiers, setNative, setPrivate, setProtected, setPublic, setStatic, setStrictfp, setSynchronized, setTransient, setVolatile
-
Methods inherited from class net.sourceforge.pmd.lang.java.ast.AbstractJavaAccessTypeNode
getType, getTypeDefinition, setType, setTypeDefinition
-
Methods inherited from class net.sourceforge.pmd.lang.java.ast.AbstractJavaNode
childrenAccept, comment, comment, getScope, getXPathNodeName, jjtAccept, jjtClose, jjtOpen, setScope
-
Methods inherited from class net.sourceforge.pmd.lang.ast.AbstractNode
appendElement, findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getNthParent, getParentsOfType, getUserData, getXPathAttributesIterator, hasDecendantOfAnyType, hasDescendantMatchingXPath, hasDescendantOfAnyType, hasDescendantOfType, hasImageEqualTo, isFindBoundary, isSingleLine, jjtAddChild, jjtGetChild, jjtGetChildIndex, jjtGetFirstToken, jjtGetId, jjtGetLastToken, jjtGetNumChildren, jjtGetParent, jjtSetChildIndex, jjtSetFirstToken, jjtSetLastToken, jjtSetParent, remove, removeChildAtIndex, setDataFlowNode, setImage, setUserData, testingOnlySetBeginColumn, testingOnlySetBeginLine, testingOnlySetEndColumn, testingOnlySetEndLine, toString
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.AccessNode
getModifiers, isAbstract, isDefault, isFinal, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setAbstract, setDefault, setFinal, setModifiers, setNative, setPrivate, setProtected, setPublic, setStatic, setStrictfp, setSynchronized, setTransient, setVolatile
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.ASTAnyTypeDeclaration
getDeclarations, getTypeKind
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.JavaNode
childrenAccept, getScope, jjtAccept, setScope
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.TypeNode
getType, getTypeDefinition, setType, setTypeDefinition
-
-
-
-
Method Detail
-
isNested
public final boolean isNested()
Description copied from interface:ASTAnyTypeDeclaration
Returns true if this type declaration is nested inside an interface, class or annotation.- Specified by:
isNested
in interfaceASTAnyTypeDeclaration
-
enclosingTypeIsA
public final boolean enclosingTypeIsA(ASTAnyTypeDeclaration.TypeKind... kinds)
Returns true if the enclosing type of this type declaration is any of the given kinds. If this declaration is a top-level declaration, returns false. This won't consider anonymous classes until #905 is tackled. TODO 7.0.0- Parameters:
kinds
- Kinds to test
-
getEnclosingTypeDeclaration
public final ASTAnyTypeDeclaration getEnclosingTypeDeclaration()
Returns the enclosing type of this type, if it is nested. Otherwise returns null. This won't consider anonymous classes until #905 is tackled. TODO 7.0.0
-
getQualifiedName
public final JavaTypeQualifiedName getQualifiedName()
Description copied from interface:JavaQualifiableNode
Returns a qualified name for this node.- Specified by:
getQualifiedName
in interfaceASTAnyTypeDeclaration
- Specified by:
getQualifiedName
in interfaceJavaQualifiableNode
- Specified by:
getQualifiedName
in interfacenet.sourceforge.pmd.lang.ast.QualifiableNode
- Returns:
- A qualified name.
-
setQualifiedName
public void setQualifiedName(JavaTypeQualifiedName qualifiedName)
-
getDeclaredAnnotations
public java.util.List<ASTAnnotation> getDeclaredAnnotations()
Description copied from interface:Annotatable
Get all annotations present on this node.- Specified by:
getDeclaredAnnotations
in interfaceAnnotatable
- Returns:
- all annotations present on this node.
-
getAnnotation
public ASTAnnotation getAnnotation(java.lang.String annotQualifiedName)
Description copied from interface:Annotatable
Get specific annotaion on this node.- Specified by:
getAnnotation
in interfaceAnnotatable
- Parameters:
annotQualifiedName
- qulified name of the annotation.- Returns:
ASTAnnotaion
node if the annotation is present on this node, elsenull
-
isAnnotationPresent
public boolean isAnnotationPresent(java.lang.String annotQualifiedName)
Description copied from interface:Annotatable
Checks whether the annotation is present on this node.- Specified by:
isAnnotationPresent
in interfaceAnnotatable
- Parameters:
annotQualifiedName
- qulified name of the annotation.- Returns:
true
if the annotation is present on this node, elsefalse
-
isAnyAnnotationPresent
public boolean isAnyAnnotationPresent(java.util.Collection<java.lang.String> annotQualifiedNames)
Description copied from interface:Annotatable
Checks whether any annotation is present on this node.- Specified by:
isAnyAnnotationPresent
in interfaceAnnotatable
- Parameters:
annotQualifiedNames
- collection that cotains qulified name of annotations.- Returns:
true
if any annotation is present on this node, elsefalse
-
-