|
From: <php...@li...> - 2009-01-11 12:25:38
|
Hi Jost,
thanks for your answer, but you don't seem to get what I wanted to do:
You are showing me how to call testA() on an already existing PHP
object.
But I wanted to invoke a method with its name given as a String, so:
not: A.testA(B)
but: A.invokeMethod("testA", B)
Therefore I do not see why the Java part would need to know about the
methods available on A.
The only thing it has to do is:
- find object A in PHP (formerly created with "java_closure( new A() )")
- find object B in PHP (formerly created with "java_closure( new B() )")
- tell object A to invoke a method (given as a generic String, here:
"testA") with object B as parameter.
If I look at the Javadoc of the Java script-api, it says:
/**
* Invokes a procedure on an object which already defined in the
* script using the array of objects as its arguments set.
*
* @param methodName name of the procedure to be invoked
* @param thiz object on which the procedure is called
* @param args arguments set for the procedure
* @return resultant object after the execution of the
* procedure
* @throws ScriptException if the invocation of the procedure
* fails
*/
public Object invokeMethod(Object thiz,String methodName,Object[] args)
throws
ScriptException, NoSuchMethodException;
=> That's exactly what I want to do, isn't it?
It does not say that I first have to use getInterface() in order to
proof whether "thiz" understands method "methodName".
It also doesn't say that the args are not allowed to be script proxies
as well.
So, do I still get something wrong here or is this just not supported by
the PHP-Java-bridge?
Regards Juergen
|