So if I understand you correctly you don't want to write any custom
embedding code, but you want your JS files to be compiled on the fly.
This sounds very much like the problem I'm just trying to solve for
using Rhino on Android. My plan is to create a custom build step that
triggers the .js -> .class compilation.
What I'm still unsure is how to specify what classes or interfaces
should be implemented by script files. One way is to have some sort of
external config file, the other would be to have a directive in the
source code similar to the "use strict" of ES5 strict mode:
"extends org.foo.MyClass";
"implements com.bar.MyInterface";
If you're interested in this you can follow its development over in
the jsdroid google group:
http://groups.google.com/group/jsdroid
Hannes
On Feb 27, 7:05 pm, PatrickCD <
patrick.do...@gmail.com> wrote:
> Thanks for the pointer.
>
> Actually, apologies, my question / the title of this thread was badly
> put.
>
> I can see how to implement an interface, and I'm comfortable running
> rhino scripts and calling out to Java.
>
> My problem is that I need the application container (Spring) to be
> able to instanciate and register an object that implements an
> interface. I want to implement the interface via a rhino script.
>
> One idea I had was to compile the script, using the -implements option
> as described here :
>
>
http://www.mozilla.org/rhino/jsc.html
>
> This looks like a good option for a production environment, but at
> least for development I'd like the script to be revaluated
> dynamically.
>
> On Feb 27, 4:08 pm, Jeb Beich <
jebbe...@gmail.com> wrote:
>
>
>
>
>
>
>
> > There's a section of the docs which describes implementing java interfaces:
>
> >
http://www.mozilla.org/rhino/ScriptingJava.html(halfway down)