I need some advice on a paradigm to follow. Before, I had something like this
package/Instantiator.class
package/instances/GenericInstance.class (abstract)
package/instances/AInstance.class (extends Generic)
package/instances/BInstance.class (extends Generic)
What Instantiator
did was to search package/instances
folder for all class files, and instantiated each with reflection and call an abstract method on all the instances and collected output and save to a DB.
Howver, I have to package my code in a Jar now, and Java does not seem to allow searching for all class files in a package in a jar (since it seems to mess with pathing).
I could add all instances in a List in GenericInstance or something, and then Instantiator could just get the list of classes.
But I would like for other people to just be able to add a class to that package and that's it.
What pattern should I follow here? Any code help? Thanks!