geronimo-xbean-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: xbean-finder: ClassFinder
Date Thu, 02 Nov 2006 07:13:00 GMT
More updates to the ClassFinder....

You can now construct the finder with exactly the list of classes you  
want to search for annotations.  It uses var args too, so you can  
easily specify one class if you like.  Convenient for when you have  
some of the code that "picks" which class or classes should be  
scraped for annotated methods, fields, constructors, etc.

I also added a 'findClassesInPackage' method that allows you to suck  
in all the classes under a certain package name.  This can be done  
recursively or not.


On Oct 30, 2006, at 8:47 PM, David Blevins wrote:

> On Oct 27, 2006, at 12:13 PM, David Blevins wrote:
>> So added a finder for searching for classes that have a specific  
>> annotation, etc.  It's there it works and is better than some of  
>> the code i've seen that does the same, but... I still hate it as  
>> like all the approaches I've seen it loads the classes and uses  
>> reflection to determine if the annotation is present.
>> This is the most insecure code I can think of, so I'm yanking it  
>> in leu of an asm-based approach.  So take this as your warning not  
>> to start consuming the ClassFinder just yet.
> Done.  It's now ASM-based and you can lookup any of the following  
> annotated things:
>   - Packages
>   - Classes
>   - Constructors
>   - Methods
>   - Fields
> Reflection does not occur till you ask for a set of classes that  
> have the annotation you require.  The loaded classes are then kept  
> for future use.
> -David

View raw message