I have this requirement.
There are a bunch of classes in a package. Each class has constructors. I want to print out all the constructors of those classes in that package.
NOTE: I checked reflections, where it allows to print the constructor names for any class, just at the class level.
try {
Constructor<?>[] publicConstructors = Class.forName("class_name").getConstructors();
System.out.println(Arrays.toString(publicConstructors));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
But I want to print all the constructors at the package level.
Is this possible? Please help.