On Mar 25, 3:58 pm, Norris Boyd <[EMAIL PROTECTED]> wrote: > So the question is then what WrapFactory.wrap() should do.
Well, IMHO jsToJava and javaToJs should always lead to consistent results? IMHO there should be no question on that. Actually I think that NativeJavaClass should do both, static methods/ vars AND the reflection methods. Maybe exposing a child object (__reflect__ and __static__?) if names would clash (unlikely). Anyways, thanks for the explanation, I somehow (how?! ;-) forgot that static is not the same like class methods. > So I think WrapFactory.wrap() does the right thing now, but I can see > a missing piece of functionality in the API. How does this come up for > you? What are you trying to do? Puh ;-) Basically I use a Map to store the values of a scope on the Java side. You can imagine it like using a regular Map<String,Object> as the slot store (with the values being converted to/from Java). Actually its NativeJavaObject subclasses which expose the Java API but also allow attaching additional JS slots (functions, etc). You can find the relevant source (WrapFactory etc) here: http://getobjects.googlecode.com/svn/core/trunk/org/getobjects/jsapp/ The setup is a bit complex due to caching of .js files in shared scopes. Anyways, because I map back and forth, Classes get mixed up with strange effects (eg static methods are available on the first run, but get lost on subsequent runs. most likely because some representation is 'cached' and enters the a/b/c loop). Right now everything works as expected after I manually added the java.lang.Class=>NativeJavaClass conversion in my WrapFactory: http://getobjects.googlecode.com/svn/core/trunk/org/getobjects/jsapp/adapter/JSWrapFactory.java Thinking about it, I really suggest that there should be just one object representing Java classes in JS. Thanks, Helge -- http://www.helgehess.eu/ _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
