|
From: Rod J. <ro...@in...> - 2004-10-01 20:49:15
|
Ugo Look at the beanshell support, also in the sandbox. This creates an interface from the bean properties, along with an introduction to set the properties. Your introduction could use whatever API to "implement" the setters. Good to meet you at JAOO! Rgds Rod -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of Ugo Cei Sent: 30 September 2004 12:28 To: spr...@li... Subject: Re: [Springframework-developer] Groovy/Spring 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/ |