Subj : Re: Using reflection with Rhino "beans" To : Ugo Cei From : Igor Bukanov Date : Fri Oct 01 2004 06:40 pm Ugo Cei wrote: > Great! Now, if you'd like to know why I want to do this in Java, it is > because I want to be able to define "JavascriptBeans" that can be > managed by an IoC container like Spring just as well as ordinary > JavaBeans are. It's the container that creates new bean instances, so > I cannot do that in the JS code. I want the adaptation to be > transparent. > > With the Adapter trick, I am almost there. The only problem left is > that setters take an Object as an argument instead of the real class, > which probably means that I need to define a Java interface to > implement. You may also consider ClassCompiler, http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/optimizer/ClassCompiler.html which allows to compile JS sources into JVM class files that can be packaged as jar etc. See also documentation to JavaScript compiler, http://www.mozilla.org/rhino/jsc.html http://lxr.mozilla.org/mozilla/source/js/rhino/toolsrc/org/mozilla/javascript/tools/jsc/Main.java which is a command line tools that wraps the interface and examples/NervousText.js examples/NervousText.html in Rhino distribution or CVS that show how to write Applet in JavaScript. Regards, Igor .