I am ok with this, just one Q; Where does it go? Bootstrap? Cheers
On Mon, May 30, 2011 at 10:30 AM, Rickard Öberg <[email protected]> wrote: > Hi, > > In our project we have lots and lots of values, entities and transient > objects that need to be registered, and I myself consistently forget to do > it. So, I have now finally implemented a simple classpath scanner that helps > bulk registering of classes. > > Here's how it works. You give it a "starting point" class. From there it > finds the corresponding path (file system or jars are supported), and > traverse that to return an Iterable<Class> that can then be further > filtered. This can then be used to register classes in Qi4j assemblies > easily. > > Example> > for( Class aClass : filter( matches( ".*Value" ), getClasses( > TestValue.class ) )) > { > module.values(aClass); > } > --- > The getClasses() is the basic scanner, and then I've further filtered it by > saying to only include classes whose names match a particular regexp. You > can do any kind of filtering you want, of course, so it is quite flexible. > > Has anyone else seen similar requirements? Anything I should add to this > before committing? > > /Rickard > > _______________________________________________ > qi4j-dev mailing list > [email protected] > http://lists.ops4j.org/mailman/listinfo/qi4j-dev > -- Niclas Hedhman, Software Developer http://www.qi4j.org - New Energy for Java I live here; http://tinyurl.com/3xugrbk I work here; http://tinyurl.com/24svnvk I relax here; http://tinyurl.com/2cgsug _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

