php.java.bridge
Class PhpProcedure

java.lang.Object
  extended by php.java.bridge.PhpProcedure
All Implemented Interfaces:
java.lang.reflect.InvocationHandler

public final class PhpProcedure
extends java.lang.Object
implements java.lang.reflect.InvocationHandler

This class takes the supplied PHP environment and creates a dynamic proxy for calling PHP code.


Method Summary
static java.lang.Object createProxy(java.lang.Class[] interfaces, PhpProcedure proc)
          Called from getInterface().
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          
 java.lang.Object invoke(java.lang.Object proxy, java.lang.String method, java.lang.Object[] args)
          Invoke a PHP function or a PHP method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createProxy

public static java.lang.Object createProxy(java.lang.Class[] interfaces,
                                           PhpProcedure proc)
Called from getInterface().

Parameters:
interfaces - - The list of interfaces that this proxy must implement, may be empty.
proc - - A procedure obtained from java_closure().
Returns:
A new proxy instance.

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.String method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Invoke a PHP function or a PHP method.

Parameters:
proxy - The php environment or the PHP object
method - The php method name
args - the arguments
Returns:
the result or null.
Throws:
java.lang.Throwable - script exception.

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable

Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Throwable