tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Serges N. Zubkoff" <madcr...@infa.ru>
Subject Re: instance names problem will pay $2 for solution
Date Wed, 02 Apr 2003 10:32:44 GMT
Hello Michael,

Wednesday, April 2, 2003, 2:24:21 PM, you wrote:

MN> i will pay $2 usd if you can solve my problem.  i'll send check by mail or 
MN> paypal.

MN> my problem is i have a String variable s which stores the name of the 
MN> instance i want to create.  how do i convert that variable to java code so 
MN> that i can use it in my java code.

MN> for instance

MN> this is what i want to do

MN> blue.use();
MN> red.use();

MN> but have somethign like
MN> s = "blue";
MN> something(s).use();
MN> s = "red";
MN> something(s).use();

MN> which does the samething as above

MN> mike


MN> _________________________________________________________________
MN> Protect your PC - get McAfee.com VirusScan Online  
MN> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


MN> ---------------------------------------------------------------------
MN> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
MN> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Constructor constructor =
Class.forName(yurStringValue).getConstructor(new Class[]
                       {/*base class constructor parameters types*/});
yuorInstance = (YourInctanceBaseClass)constructor.
              newInstance(new Object[]{/*constructor parameters*/});


-- 
Best regards,
 Serges                            mailto:madcreep@infa.ru


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message