• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Creating a wrapper between Java Objects and Object C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a wrapper between Java Objects and Object C


  • Subject: Re: Creating a wrapper between Java Objects and Object C
  • From: Clark Cox <email@hidden>
  • Date: Tue, 23 Mar 2004 21:39:19 -0500

On Mar 23, 2004, at 14:36, Alexander F. Hartner wrote:

> I would like to either create a Java wrapper for an existing
> ObjectiveC object of vice versa. It seems to me that I have to create
> a .jobs file via Projects Builder Java Wrapper tool. This tool seems
> to have been removed in X-Code. Has anyone instructions on how to pass
> ones own object over the Java Bridge ?

For the most part, it "Just Works". Essentially, for wrapping Java
objects in Objective-C (which is the only direction with which I am
familiar), you can simply use the Objective-C syntax to call methods on
the Java objects, and most type coerecions are handled for you
automatically.

You can get a Class object representing a Java object using
NSClassFromString():

For example:
NSClassFromString(@"java.util.Vector")

You can then treat the result as if it were an Objective-C class:
id theJavaVector = [[NSClassFromString(@"java.util.Vector") alloc]
init];
[theJavaVector addElement: @"A string"];
[theJavaVector addElement: @"Another string"];
[theJavaVector addElement: [NSNumber numberWithInt: 42]];

For more information, check out:
http://cocoadevcentral.com/articles/000024.php





--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Creating a wrapper between Java Objects and Object C (From: "Alexander F. Hartner" <email@hidden>)

  • Prev by Date: Re: Graphite examples ??
  • Next by Date: NSTableView resizing oddity
  • Previous by thread: Creating a wrapper between Java Objects and Object C
  • Next by thread: how to make my plugin appears like a package ?
  • Index(es):
    • Date
    • Thread