|
From: Ugo C. <ug...@ap...> - 2004-09-30 11:28:12
|
Il giorno 30/lug/04, alle 19:38, Rod Johnson ha scritto: > I've just written something that I think is rather cool that allows a > bean > to be written in Groovy yet configured via the full power of Spring > Dependency Injection. It also supports reloading if the script changes, > preserving existing references. I am trying to do the same for Javascript (using the Mozilla Rhino interpreter) and I have been able to load a script and instantiate a prototype object (sort of like a class) defined in it. Now I'm trying to set its properties via Spring, but I found a problem in that the Javascript object is seen from Java as an instance of org.mozilla.javascript.Scriptable and doesn't define getter and setter methods for its properties. Thus, AFAIU, Spring isn't able to set its properties using reflection, whereas I suppose a Groovy class does define getters and setters. I am thinking about wrapping the Javascript object in some kind of generated proxy, but before I begin (and I don't even know *where* to begin from), I wanted to ask if someone has any suggestions about this issue. TIA, Ugo -- Ugo Cei - http://beblogging.com/ |