From JS to Java objects?

Jim Laskey (Oracle) james.laskey at oracle.com
Tue Oct 8 05:38:07 PDT 2013


You really shouldn't be using internal classes.  We can and will be changing them over time.  Use JSObject instead.


On 2013-10-08, at 2:26 PM, Tal Liron <tal.liron at threecrickets.com> wrote:

> Sorry about that, was trying to be succinct.
> 
> In detail: I'm creating Nashorn scripts programmatically from Java (using Context.compileScript and ScriptRuntime.apply), and receiving native results that need some massaging in order to be usable in Java. (Specifically I'm working on creating a Nashorn adapter for Scripturian.)
> 
> However, I mostly found the answers myself:
> 
> 1. It's possible to call NativeJava.to (equivalent to Java.to in JavaScript)
> 2. More efficient is to test specifically for NativeArray results and wrap them in a ListAdapter, which makes them conform to the List interface. This is what NativeJava.to does internally.
> 
> On 10/08/2013 08:12 PM, Jim Laskey (Oracle) wrote:
>> Please be more specific with an example.  I assume you want to extend a Java class or some such requirement,
>> 
> 



More information about the nashorn-dev mailing list