Re: Scripting engine - Java 6
- From: debasish <ghosh.debasish@xxxxxxxxx>
- Date: Tue, 31 Jul 2007 12:58:59 -0000
On Jul 31, 5:06 pm, Roedy Green <see_webs...@xxxxxxxxxxxxxxxxxxxx>
wrote:
On Tue, 31 Jul 2007 11:19:00 -0000, debasish
<ghosh.debas...@xxxxxxxxx> wrote, quoted or indirectly quoted someone
who said :
Does this mean that if I want to stick to Sun's generifying layer,
I will be using classes like sun.org.mozilla.javascript.internal.NativeArray
for data type transformations between Javascript and Java ?
Or is there any other way of achieving the same goal.
Keep in mind, if you do that, you are cheating and defeating the
purpose of what Sun has done, so your code could break at any time.
Basically you get objects, find out their class with getClass, then
write code to cast them to specific objects so you can access the
native methods. You may find the methods you need in Sun's glue
objects are private to foil such attempts.
If I return a Javascript array into Java and do a getClass(), I get sun.org.mozilla.javascript.internal.NativeArray. I understand that this is NOT programming to the interface, I am programming to the internal classes, which Java wraps. In that case what will be the best practice to use Javascript arrays which are returned from the script methods ? Of course one option will be to bypass Sun layer, use Rhino directly, possibly through something like BeanShell. But if I want to stick to Sun api, how do I deal with objects returned from Javascript ?
Cheers.
- Debasish
.
- References:
- Scripting engine - Java 6
- From: debasish
- Re: Scripting engine - Java 6
- From: Roedy Green
- Re: Scripting engine - Java 6
- From: debasish
- Re: Scripting engine - Java 6
- From: Roedy Green
- Scripting engine - Java 6
- Prev by Date: Re: tomcat log4j
- Next by Date: Re: Need efficient search strategy in list of time intervals
- Previous by thread: Re: Scripting engine - Java 6
- Next by thread: org.apache.axis cannot be resolved to a type, Syntax error on token "enum", class expected
- Index(es):
Relevant Pages
|