Interface NodeWithAnnotations<N extends Node>
- All Known Implementing Classes:
AnnotationDeclaration, AnnotationMemberDeclaration, ArrayCreationLevel, ArrayType, BodyDeclaration, CallableDeclaration, ClassOrInterfaceDeclaration, ClassOrInterfaceType, CompactConstructorDeclaration, ConstructorDeclaration, EnumConstantDeclaration, EnumDeclaration, FieldDeclaration, InitializerDeclaration, IntersectionType, MethodDeclaration, ModuleDeclaration, PackageDeclaration, Parameter, PrimitiveType, ReceiverParameter, RecordDeclaration, TypeDeclaration, TypeParameter, UnionType, VariableDeclarationExpr, VoidType, WildcardType
-
Method Summary
Modifier and TypeMethodDescriptiondefault NormalAnnotationExpraddAndGetAnnotation(Class<? extends Annotation> clazz) Annotates this node and automatically add the importdefault NormalAnnotationExpraddAndGetAnnotation(String name) Annotates thisdefault NaddAnnotation(AnnotationExpr element) default NaddAnnotation(Class<? extends Annotation> clazz) Annotates this node and automatically add the importdefault NaddAnnotation(String name) Annotates thisdefault NaddMarkerAnnotation(Class<? extends Annotation> clazz) Annotates this with a marker annotation and automatically add the importdefault NaddMarkerAnnotation(String name) Annotates this with a marker annotationdefault NaddSingleMemberAnnotation(Class<? extends Annotation> clazz, Expression expression) Annotates this with a single member annotationdefault NaddSingleMemberAnnotation(Class<? extends Annotation> clazz, String value) Annotates this with a single member annotation and automatically add the importdefault NaddSingleMemberAnnotation(String name, Expression expression) Annotates this with a single member annotationdefault NaddSingleMemberAnnotation(String name, String value) Annotates this with a single member annotationdefault AnnotationExprgetAnnotation(int i) default Optional<AnnotationExpr> getAnnotationByClass(Class<? extends Annotation> annotationClass) Try to find an annotation by its classdefault Optional<AnnotationExpr> getAnnotationByName(String annotationName) Try to find an annotation by its namedefault booleanisAnnotationPresent(Class<? extends Annotation> annotationClass) Check whether an annotation with this class is present on this elementdefault booleanisAnnotationPresent(String annotationName) Check whether an annotation with this name is present on this elementdefault NsetAnnotation(int i, AnnotationExpr element) setAnnotations(NodeList<AnnotationExpr> annotations) voidtryAddImportToParentCompilationUnit(Class<?> clazz)
-
Method Details
-
getAnnotations
NodeList<AnnotationExpr> getAnnotations() -
setAnnotations
-
tryAddImportToParentCompilationUnit
-
getAnnotation
-
setAnnotation
-
addAnnotation
-
addAnnotation
-
addAndGetAnnotation
Annotates this- Parameters:
name- the name of the annotation- Returns:
- the
NormalAnnotationExpradded
-
addAnnotation
Annotates this node and automatically add the import- Parameters:
clazz- the class of the annotation- Returns:
- this
-
addAndGetAnnotation
Annotates this node and automatically add the import- Parameters:
clazz- the class of the annotation- Returns:
- the
NormalAnnotationExpradded
-
addMarkerAnnotation
-
addMarkerAnnotation
Annotates this with a marker annotation and automatically add the import- Parameters:
clazz- the class of the annotation- Returns:
- this
-
addSingleMemberAnnotation
Annotates this with a single member annotation- Parameters:
name- the name of the annotationexpression- the part between ()- Returns:
- this
-
addSingleMemberAnnotation
Annotates this with a single member annotation- Parameters:
clazz- the class of the annotationexpression- the part between ()- Returns:
- this
-
addSingleMemberAnnotation
-
addSingleMemberAnnotation
Annotates this with a single member annotation and automatically add the import- Parameters:
clazz- the class of the annotationvalue- the value, don't forget to add \"\" for a string value- Returns:
- this
-
isAnnotationPresent
Check whether an annotation with this name is present on this element- Parameters:
annotationName- the name of the annotation- Returns:
- true if found, false if not
-
isAnnotationPresent
Check whether an annotation with this class is present on this element- Parameters:
annotationClass- the class of the annotation- Returns:
- true if found, false if not
-
getAnnotationByName
Try to find an annotation by its name- Parameters:
annotationName- the name of the annotation
-
getAnnotationByClass
Try to find an annotation by its class- Parameters:
annotationClass- the class of the annotation
-