Re: Passing classes as parameters

1998-05-26 Thread Ravi Rao
> From: "Wim Ceulemans" <[EMAIL PROTECTED]> > Date: Tue, 26 May 1998 08:45:30 +0200 > Does anyone has experience in passing a class as a parameter in java? > I want to do something like call a method with as parameter a class > name and then create instances of that class in that method. Is this

Re: Passing classes as parameters

1998-05-26 Thread Geoffrey S. Knauth
> Does anyone has experience in passing a class as a parameter in java? You can pass the name of a class ("com.foo.package.Name") as a parameter, and then so long as the class can be found either locally on the client, or via the ARCHIVE=___.jar tag, you can create an instance via something like:

Re: Passing classes as parameters

1998-05-26 Thread B. Craig Taverner
> Does anyone has experience in passing a class as a parameter in java? > I want to do something like call a method with as parameter a class name and > then create instances of that class in that method. Is this possible? try this: public Object makeInstance(String sClassName) { Class rC

Re: Passing classes as parameters

1998-05-26 Thread Pavel
Yes. If your class has a no-arg constructor, just do like this: void method(Class c) { ... Object o = c.newInstance(); ... // use 'o' } Otherwise, look for a Constructor class documenation from java.lang.reflect package to create and initialize your object

Passing classes as parameters

1998-05-26 Thread Wim Ceulemans
Hi Does anyone has experience in passing a class as a parameter in java? I want to do something like call a method with as parameter a class name and then create instances of that class in that method. Is this possible? Regards Wim Ceulemans Nice Software Solutions Eglegemweg 3, 2811 Hombeek Te