public final class AnnotationUtility extends Object
Modifier and Type | Method and Description |
---|---|
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.
|
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 forNullPointerException
- if the aAST or
aAnnotation is nullpublic static boolean containsAnnotation(DetailAST aAST)
aAST
- the current nodeNullPointerException
- if the aAST is nullpublic static DetailAST getAnnotationHolder(DetailAST aAST)
null
the passed in AST is not have an Annotation Holder.aAST
- the current nodeNullPointerException
- 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 forNullPointerException
- if the aAST or
aAnnotation is nullpublic static DetailAST annotatingWhat(DetailAST aAST)
aAST
- the AST representing an annotation.NullPointerException
- if the aAST is nullIllegalArgumentException
- 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 typeNullPointerException
- if the aAST is nullIllegalArgumentException
- if the aAST is not
an TokenTypes.ANNOTATION
Copyright © 2001-2014. All Rights Reserved.