This content has been marked as final. Show 3 replies
yes, sort of. there is no convenience method "getAllClassesInPackage(packageName)". however, you can write code which searches through classes in available classloaders and and tests these classes for criteria like "is it in this package" and "does it implement Serializable".
When you encounter a Class you can check it for 'implements Serializable' dynamically. Why therefore do you need to build a collection of such classes?
andrew222 wrote:Why do you think you need a collection of them? It sounds odd, and there might be another way to solve your real problem.
In Java, is there a way to find all classes within a package that are serializable and then add the Class object for these classes to a collection?