How can I get the annotation from the parameter of my function with javaPoet?
String dummyFunction(@DummyAnnotation String variable);
I used the following code but it returns always null , while debugging I can see all the other attributes of my parameter "e" but not the annotation.
MethodSpec m = MethodSpec.methodBuilder(k.getSimpleName().toString())
.addModifiers(Modifier.PUBLIC)
.addAnnotation(AnnotationSpec.builder(Override.class).build())
.addParameters(ee.getParameters()
.stream().peek(e -> {
System.out.println(((VariableElement) e).getAnnotation(DummyAnnotation.class))
}
thanks for your help
Aucun commentaire:
Enregistrer un commentaire