Although the title says quite all, let me explain a little further.
I've written a library in which I do some introspection on Java fields to have their annotation list (and more specifically to see if they have one or more specific annotations (like - say, @Id
, @Child
, @Parent
). Here is an example of the kind of code I use :
@Override
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
return mapped.getAnnotation(annotationClass);
}
Where mapped
is a Java Field (and as a consequence has a getAnnotation(Annotation)
method). I want to port this method to Groovy.
I've already have understood that using Groovy, I have to replace my Fields (or bean properties) by MetaProperties. however, I face an issue considering the use of these annotations, as it seems that groovy handles them very differently from Java.
So, is it possible to consider a migration path from Java annotations to Groovy AnnotationNode, or will i have to create an abstraction over those concepts ?