cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <>
Subject [Flow] ScriptableObject and inheritance
Date Wed, 01 Oct 2003 22:40:36 GMT
Please have a look at the attached files. If I call the "test()" 
function from the flow, the output is the following:

computePI: 3.141592653589793
"file:test.js", line 8: uncaught JavaScript exception: TypeError: 
computePI is not a function.

In other words, if I define a public method in a base class, it is not 
inherited by a derived class, at least according to Rhino.

I was finding this rather baffling (how can you determine if a method is 
inherited or not?) but looking at the documentation of 
java.lang.Class.getDeclaredMethods(), I found a possible answer:

"This includes public, protected, default (package) access, and private 
methods, but excludes inherited methods."

Probaly Rhino uses getDeclaredMethods() instead of getMethods()? Is 
there any particular reason for this choice?

The problem is I am writing a component to be used from Javascript and I 
want it to have a polymorphic behavior.Is there a way to somehow tell 
the derived object to automatically expose all the inherited 
jsFunction|jsGet|jsSet methods? Or should I stick to a plain Java object 
and forget about Scriptable?

	Thanks in Advance,


View raw message