swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: porting Obj-C to Java: objc_get_class


From: Nelson Minar
Subject: Re: porting Obj-C to Java: objc_get_class
Date: Thu, 3 Aug 2000 18:37:55 -0700 (PDT)

>Greetings all. I'm porting some code to java (and loving it). In my Obj-C
>code, I used to have the following:
>Class mClass;
>mClass = objc_get_class(attributeValue);
>mMonitor = [mClass create: [self getZone]];
>where attributeValue is declared char[MAXLINE] and mMonitor is declared id.

Try

  Class mClass = Class.forName(attributeValue);
  mMonitor = mClass.newInstance();

this works if your class doesn't need any arguments to the
constructor. If that's not good enough, see the docs for the
java.lang.reflect package.

                                                     address@hidden
.       .      .     .    .   .  . . http://www.media.mit.edu/~nelson/

Make your computer useful 24 hours a day: http://www.popularpower.com/

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]