|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.puppycrawl.tools.checkstyle.api.AnnotationUtility
public final class AnnotationUtility
Contains utility methods designed to work with annotations.
Method Summary | |
---|---|
static DetailAST |
annotatingWhat(DetailAST aAST)
Checks to see what the passed in AST (representing an annotation) is annotating. |
static boolean |
containsAnnotation(DetailAST aAST)
Checks to see if the AST is annotated with any annotation. |
static boolean |
containsAnnotation(DetailAST aAST,
String aAnnotation)
Checks to see if the AST is annotated with the passed in annotation. |
static DetailAST |
getAnnotation(DetailAST aAST,
String aAnnotation)
Checks to see if the AST is annotated with the passed in annotation and return the AST representing that annotation. |
static DetailAST |
getAnnotationHolder(DetailAST aAST)
Gets the AST that holds a series of annotations for the potentially annotated AST. |
static boolean |
isAnnotatingType(DetailAST aAST,
int aTokenType)
Checks to see if the passed in AST (representing an annotation) is annotating the passed in type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean containsAnnotation(DetailAST aAST, String aAnnotation)
This method will not look for imports or package statements to detect the passed in annotation.
To check if an AST contains a passed in annotation taking into account fully-qualified names (ex: java.lang.Override, Override) this method will need to be called twice. Once for each name given.
aAST
- the current nodeaAnnotation
- the annotation name to check for
NullPointerException
- if the aAST or
aAnnotation is nullpublic static boolean containsAnnotation(DetailAST aAST)
aAST
- the current node
NullPointerException
- if the aAST is nullpublic static DetailAST getAnnotationHolder(DetailAST aAST)
null
the passed in AST is not have an Annotation Holder.
aAST
- the current node
NullPointerException
- if the aAST is nullpublic static DetailAST getAnnotation(DetailAST aAST, String aAnnotation)
This method will not look for imports or package statements to detect the passed in annotation.
To check if an AST contains a passed in annotation taking into account fully-qualified names (ex: java.lang.Override, Override) this method will need to be called twice. Once for each name given.
aAST
- the current nodeaAnnotation
- the annotation name to check for
NullPointerException
- if the aAST or
aAnnotation is nullpublic static DetailAST annotatingWhat(DetailAST aAST)
aAST
- the AST representing an annotation.
NullPointerException
- if the aAST is null
IllegalArgumentException
- if the aAST is not
an TokenTypes.ANNOTATION
public static boolean isAnnotatingType(DetailAST aAST, int aTokenType)
aAST
- the AST representing an annotationaTokenType
- the passed in type
NullPointerException
- if the aAST is null
IllegalArgumentException
- if the aAST is not
an TokenTypes.ANNOTATION
|
Back to the Checkstyle Home Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |