Package Loader? like Class Loader with Reflect

Hi, need some help with this one. I've successfully imported some external classes through a module however there a lot of classes to manually reflect each one. Is there a thing like Package Loader?

You can just create public static final fields to hold the classes. See this example:

Then those names, in whatever system.... namespace you specified, can be used without import.

3 Likes

Wait! That was you I showed that to.

What more are you trying to do?

4 Likes

You could probably, if you really wanted to, come up with some code generation tool to spit out a simple static class with all the appropriate public static final declarations, compiled together at build time.

Probably less work to just do it once in a while manually, though.

1 Like

Sounds awfully familiar....

Yes, I do that. My Image Streamer module handles pretty much whatever version of OpenCV that's available. Intelligently produces usable jython classes and constants from what's in the OpenCV jar.

I want to import some classes of org.apache.commons.imaging (Apache Commons Imaging 1.0-alpha3 API), another: org.apache.commons.imaging.color (Apache Commons Imaging 1.0-alpha3 API) and another org.apache.commons.imaging.common (Apache Commons Imaging 1.0-alpha3 API) and some others but I constantly need to edit the module for new classes I suddenly need. I would like just to import the whole package and done.

Haha great memory!

mmm sound like a great solution. Any tool in mind? I was thinking do it manually with Java.