AnnotationDeclaration
, AnnotationMemberDeclaration
, ArrayCreationLevel
, ArrayType
, BodyDeclaration
, CallableDeclaration
, ClassOrInterfaceDeclaration
, ClassOrInterfaceType
, ConstructorDeclaration
, EnumConstantDeclaration
, EnumDeclaration
, FieldDeclaration
, InitializerDeclaration
, IntersectionType
, MethodDeclaration
, ModuleDeclaration
, Name
, PackageDeclaration
, Parameter
, PrimitiveType
, TypeDeclaration
, TypeParameter
, UnionType
, VariableDeclarationExpr
, VoidType
, WildcardType
public interface NodeWithAnnotations<N extends Node>
Modifier and Type | Method | Description |
---|---|---|
default NormalAnnotationExpr |
addAndGetAnnotation(Class<? extends Annotation> clazz) |
Annotates this node and automatically add the import
|
default NormalAnnotationExpr |
addAndGetAnnotation(String name) |
Annotates this
|
default N |
addAnnotation(AnnotationExpr element) |
|
default N |
addAnnotation(Class<? extends Annotation> clazz) |
Annotates this node and automatically add the import
|
default N |
addAnnotation(String name) |
Annotates this
|
default N |
addMarkerAnnotation(Class<? extends Annotation> clazz) |
Annotates this with a marker annotation and automatically add the import
|
default N |
addMarkerAnnotation(String name) |
Annotates this with a marker annotation
|
default N |
addSingleMemberAnnotation(Class<? extends Annotation> clazz,
String value) |
Annotates this with a single member annotation and automatically add the import
|
default N |
addSingleMemberAnnotation(String name,
Expression expression) |
Annotates this with a single member annotation
|
default N |
addSingleMemberAnnotation(String name,
String value) |
Annotates this with a single member annotation
|
default AnnotationExpr |
getAnnotation(int i) |
|
default Optional<AnnotationExpr> |
getAnnotationByClass(Class<? extends Annotation> annotationClass) |
Try to find an annotation by its class
|
default Optional<AnnotationExpr> |
getAnnotationByName(String annotationName) |
Try to find an annotation by its name
|
NodeList<AnnotationExpr> |
getAnnotations() |
|
default boolean |
isAnnotationPresent(Class<? extends Annotation> annotationClass) |
Check whether an annotation with this class is present on this element
|
default boolean |
isAnnotationPresent(String annotationName) |
Check whether an annotation with this name is present on this element
|
default N |
setAnnotation(int i,
AnnotationExpr element) |
|
N |
setAnnotations(NodeList<AnnotationExpr> annotations) |
|
void |
tryAddImportToParentCompilationUnit(Class<?> clazz) |
NodeList<AnnotationExpr> getAnnotations()
N setAnnotations(NodeList<AnnotationExpr> annotations)
void tryAddImportToParentCompilationUnit(Class<?> clazz)
default AnnotationExpr getAnnotation(int i)
default N setAnnotation(int i, AnnotationExpr element)
default N addAnnotation(AnnotationExpr element)
default N addAnnotation(String name)
name
- the name of the annotationdefault NormalAnnotationExpr addAndGetAnnotation(String name)
name
- the name of the annotationNormalAnnotationExpr
addeddefault N addAnnotation(Class<? extends Annotation> clazz)
clazz
- the class of the annotationdefault NormalAnnotationExpr addAndGetAnnotation(Class<? extends Annotation> clazz)
clazz
- the class of the annotationNormalAnnotationExpr
addeddefault N addMarkerAnnotation(String name)
name
- the name of the annotationdefault N addMarkerAnnotation(Class<? extends Annotation> clazz)
clazz
- the class of the annotationdefault N addSingleMemberAnnotation(String name, Expression expression)
name
- the name of the annotationexpression
- the part between ()default N addSingleMemberAnnotation(String name, String value)
name
- the name of the annotationvalue
- the value, don't forget to add \"\" for a string valuedefault N addSingleMemberAnnotation(Class<? extends Annotation> clazz, String value)
clazz
- the class of the annotationvalue
- the value, don't forget to add \"\" for a string valuedefault boolean isAnnotationPresent(String annotationName)
annotationName
- the name of the annotationdefault boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
annotationClass
- the class of the annotationdefault Optional<AnnotationExpr> getAnnotationByName(String annotationName)
annotationName
- the name of the annotationdefault Optional<AnnotationExpr> getAnnotationByClass(Class<? extends Annotation> annotationClass)
annotationClass
- the class of the annotationCopyright © 2007–2019. All rights reserved.