Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"Late Binding" to reduce dependencies

mwildamMay 6 2009 — edited May 18 2009
I have written a library that has some methods that should extract data from a passed Swing component. Depending on the contents there might be different operations needed.

What I now do notice that I get a bunch of dependencies to external classes when accessing several widgets on the component (there can be SwingX widgets and other 3rd party widgets). Some of those components I want to support but I do not necessarily include all these components in my library. It might be that several widgets will be found only on 10% of the cases where the library will be used and I do not want to bloat my library.

Is there a way in Java that I can do some sort of "late binding" - so that I load classes at runtime and call particular methods at runtime only?

I did find out how to load classes at runtime but anyway I must "know" some interface class for them at compile time (adding those to the project). So this is not really late binding as I need to include the appropriate interface class at compile time.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 15 2009
Added on May 6 2009
26 comments
469 views