Hi I am currently trying my hand at an AnnotationProcessor for Java. The only problem I have now is how to get the Declared Fields for the class over which the annotation is placed.
Does anyone know how to get the fields?
Once you get the element, you loop over the enclosed elements and filter by element kind:
typeElement.getEnclosedElements().stream()
.filter(e -> ElementKind.FIELD.equals(e.getKind()))
.collect(Collectors.toList());