private static Annotation [ ] extractAllAnnotationsForProperty ( Class < ? > clazz , String propertyName , boolean useRead ) { try { Annotation [ ] annotations = findPropertyAnnotations ( clazz , propertyName , useRead ) ; /* In the land of dynamic proxied AOP classes, * this class could be a proxy. This seems like a bug * waiting to happen. So far it has worked... */ if ( annotations . length == 0 ) { annotations = findPropertyAnnotations ( clazz . getSuperclass ( ) , propertyName , useRead ) ; } return annotations ; } catch ( Exception ex ) { return Exceptions . handle ( Annotation [ ] . class , sputs ( "Unable to extract annotation for property" , propertyName , " of class " , clazz , " useRead " , useRead ) , ex ) ; } }
Extract all annotation for a given property . Searches current class and if none found searches super class for annotation . We do this because the class could be proxied with AOP .