Retrieving classes in a package

Hello,

is it possible to iterate through an array of Class-instances just by providing a package that contains those classes?

I want to replace this code:

configuration.addAnnotatedClass(de.company.name.je.application.entity.BusinessObject.class);

configuration.addAnnotatedClass(de.company.name.je.application.entity.Car.class);

configuration.addAnnotatedClass(de.company.name.je.application.entity.Customer.class);

configuration.addAnnotatedClass(de.company.name.je.application.entity.CarStorage.class);

configuration.addAnnotatedClass(de.company.name.je.application.entity.Rent.class);

As you might have realized all classes are within the entity-package.

Thanks in advance!

Message was edited by:

rapthor

[782 byte] By [rapthora] at [2007-11-27 3:35:00]
# 1
No because the classes known to the JVM isn't a closed set. You would have to find one or more JAR files and iterate through those.
ejpa at 2007-7-12 8:38:10 > top of Java-index,Core,Core APIs...