Exposing Java objects with custom getters/setters with LiveConnect

Cameron McCormack <[email protected]> Tue, 17 Jul 2007 10:25:35 +1000
Newsgroups gmane.comp.mozilla.devel.java
Message-ID <bOydnTlRaOIukQHbnZ2dnUVZ_ualnZ2d__17054.3041466319$1184632223$gmane$org@mozilla.org>
Hi everyone.

Hopefully this is the most appropriate place for my question.

I am trying to integrate the scripting environment of Batik[1] running
in an applet, which uses Rhino, and that of the surrounding web page,
provided by Mozilla.  I've managed to do a reasonable job reflecting
JSObjects that represent the ECMAScript objects from the Mozilla side
into Rhino using a custom WrapFactory.  However, I'm at a loss as to how
I can control how my Java objects from the Rhino side can be exposed
into Mozilla's scripting environment with any degree of control.

It seems by default that LiveConnect will take all of the public methods
and instance variables of an object and make them correspond to
properties of the ECMAScript host object.  I'd like to expose properties
in a custom manner, however: I want to forward all [[Get]], [[Put]],
[[Delete]], etc. calls to the Rhino object that has been wrapped by
LiveConnect.  Is that possible at all?  Ideally, I'd like to simply
implement an interface like Rhino's org.mozilla.javascript.Scriptable to
provide the ECMAScript functionality of the LiveConnect wrapper.

And of course I'd like to do this in a cross-platform manner. :)

I get the feeling that there isn't any provision with LiveConnect to do
this.  Will there be any further revisions to LiveConnect, or is that
pretty much a thing of the past now?

Thanks,

Cameron

[1] http://xmlgraphics.apache.org/batik/

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:[email protected]  ▪  ICQ 26955922  ▪  MSN [email protected]
_______________________________________________
dev-tech-java mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-java