public interface NodeWithAnnotations<N extends Node>
Modifier and Type | Method and Description |
---|---|
default NormalAnnotationExpr |
addAndGetAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
Annotates this node and automatically add the import
|
default NormalAnnotationExpr |
addAndGetAnnotation(java.lang.String name)
Annotates this
|
default N |
addAnnotation(AnnotationExpr element) |
default N |
addAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
Annotates this node and automatically add the import
|
default N |
addAnnotation(java.lang.String name)
Annotates this
|
default N |
addMarkerAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
Annotates this with a marker annotation and automatically add the import
|
default N |
addMarkerAnnotation(java.lang.String name)
Annotates this with a marker annotation
|
default N |
addSingleMemberAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz,
java.lang.String value)
Annotates this with a single member annotation and automatically add the import
|
default N |
addSingleMemberAnnotation(java.lang.String name,
Expression expression)
Annotates this with a single member annotation
|
default N |
addSingleMemberAnnotation(java.lang.String name,
java.lang.String value)
Annotates this with a single member annotation
|
default AnnotationExpr |
getAnnotation(int i) |
default java.util.Optional<AnnotationExpr> |
getAnnotationByClass(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Try to find an annotation by its class
|
default java.util.Optional<AnnotationExpr> |
getAnnotationByName(java.lang.String annotationName)
Try to find an annotation by its name
|
NodeList<AnnotationExpr> |
getAnnotations() |
default boolean |
isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Check whether an annotation with this class is present on this element
|
default boolean |
isAnnotationPresent(java.lang.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(java.lang.Class<?> clazz) |
NodeList<AnnotationExpr> getAnnotations()
N setAnnotations(NodeList<AnnotationExpr> annotations)
void tryAddImportToParentCompilationUnit(java.lang.Class<?> clazz)
default AnnotationExpr getAnnotation(int i)
default N setAnnotation(int i, AnnotationExpr element)
default N addAnnotation(AnnotationExpr element)
default N addAnnotation(java.lang.String name)
name
- the name of the annotationdefault NormalAnnotationExpr addAndGetAnnotation(java.lang.String name)
name
- the name of the annotationNormalAnnotationExpr
addeddefault N addAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
clazz
- the class of the annotationdefault NormalAnnotationExpr addAndGetAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
clazz
- the class of the annotationNormalAnnotationExpr
addeddefault N addMarkerAnnotation(java.lang.String name)
name
- the name of the annotationdefault N addMarkerAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
clazz
- the class of the annotationdefault N addSingleMemberAnnotation(java.lang.String name, Expression expression)
name
- the name of the annotationexpression
- the part between ()default N addSingleMemberAnnotation(java.lang.String name, java.lang.String value)
name
- the name of the annotationvalue
- the value, don't forget to add \"\" for a string valuedefault N addSingleMemberAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz, java.lang.String value)
clazz
- the class of the annotationvalue
- the value, don't forget to add \"\" for a string valuedefault boolean isAnnotationPresent(java.lang.String annotationName)
annotationName
- the name of the annotationdefault boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
annotationClass
- the class of the annotationdefault java.util.Optional<AnnotationExpr> getAnnotationByName(java.lang.String annotationName)
annotationName
- the name of the annotationdefault java.util.Optional<AnnotationExpr> getAnnotationByClass(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
annotationClass
- the class of the annotation