This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Factory + ClassLoader Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "Factory + ClassLoader Question" Watch "Factory + ClassLoader Question" New topic

Factory + ClassLoader Question

Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Hi guys -
Given: A set of class objects returned by fctory methods, e.g. Factory.getInstance().
Requirement: Dynamic loading of these classes.
Statement: In all cases, this requires a custom ClassLoader.
Is the 'Statement' correct?
Regards, Guy
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
I'm not sure what you're saying. Given a "set of class objects"? What are these, and how do they relate to the classes you want to load? Are these instances of the class Class? Instances of some other class, like maybe the one you want to load? In either of the above cases, it would seem you need to load the desired class before you can have any instances of that class, or of Class objects which represent your desired class. So I'm probably missing something here. Perhaps you could show a bit more of an example of what you're talking about?

"I'm not back." - Bill Harding, Twister
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
If you are trying to implement dynamic re-loading of classes, then you will need a custom ClassLoader.
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Ah, yes. Agreed.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Factory + ClassLoader Question
jQuery in Action, 3rd edition