Is there a way to reference the engine from a linker?
Attila Szegedi
szegedia at gmail.com
Wed Apr 4 17:20:50 UTC 2018
Sorry for an awfully late response, but hope it might still help: Java.asJSONCompatible delegates on the Java side to jdk.nashorn.api.scripting.wrapAsJSONCompatible. It’s part of Nashorn’s supported public API, so it should be fine for you to call it.
I’m actually wondering how useful is that API method - you need to pass a “homeGlobal” parameter, and honestly I’m not really sure how you’d obtain that. Maybe Sundar has an idea.
Attila.
> On 2018. Mar 15., at 20:02, Paulo Lopes <plopes at redhat.com> wrote:
>
> Hi,
>
> I'm writing a guarded linker to allow custom casting from JSObject to Vertx
> custom types. So far so good, the basic tests seem to work but I think I'm
> writing too much boiler plate code as I need in many times to have an
> intermediate conversion from JSObject to Map or List.
>
> So I know that in the engine I could call Java.asJSONCompatible() but I
> don't see how I could get a reference to the engine in the linker.
>
> Could anyone see a way or let me know if there is a open API to do this?
>
> Thanks!
> Paulo
More information about the nashorn-dev
mailing list