geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Annotation Inheritance
Date Fri, 22 Jun 2007 18:07:23 GMT

On Jun 21, 2007, at 10:48 AM, Tim McConnell wrote:

> Hi, I'm trying to better understand how Geronimo handles  
> inheritance of annotations. Is that something we've delegated  
> solely to our usage of ClassFinder ?? Or is that something that is  
> implemented elsewhere in the Geronimo code ?? Thanks for any  
> information....

The way we did it in OpenEJB and I think the way that made it into  
Geronimo was to continue to use the ClassFinder as normal, but  
instead of feeding it just the one class we walk up the inheritance  
chain and add the super classes like so:

         private ClassFinder createInheritedClassFinder(Class clazz) {
             List<Class> parents = new ArrayList<Class>();
             parents.add(clazz);
             Class parent = clazz;
             while ((parent = parent.getSuperclass()) != null) {
                 parents.add(parent);
             }

             return new ClassFinder(parents);
         }

Then all the code that would use that ClassFinder to find annotated  
methods/fields can remain unchanged.

-David


Mime
View raw message