?
=?iso-8859-1?B?bW9vcJk=?=
Hi,
I am using a factory class to build instances. the factory method looks
like:
<code>
class MyFactory{
Item getItem(String key){
...}
}
</code>
and the key and class are configured in a file
key=com.abcd.ClassA
b=com.abcd.B
<code>Item</code> is an interface implemented by some of the above
classes mentioned inside the cofiguration file.
I want the factory class to read the configuration file and then
instantiate the given class and as a return value. But I have no idea
how to instantiate the class. I tried Class.forName() and seesm it is
not a good solution to this problem.
I am using a factory class to build instances. the factory method looks
like:
<code>
class MyFactory{
Item getItem(String key){
...}
}
</code>
and the key and class are configured in a file
key=com.abcd.ClassA
b=com.abcd.B
<code>Item</code> is an interface implemented by some of the above
classes mentioned inside the cofiguration file.
I want the factory class to read the configuration file and then
instantiate the given class and as a return value. But I have no idea
how to instantiate the class. I tried Class.forName() and seesm it is
not a good solution to this problem.