Skip to content

Most visited

Recently visited

navigation
Added in API level 1

InvocationHandler

public interface InvocationHandler

java.lang.reflect.InvocationHandler


Implementors of this interface dispatch methods invoked on proxy instances.

See also:

Summary

Public methods

abstract Object invoke(Object proxy, Method method, Object[] args)

Handles the method which was originally invoked on the proxy instance.

Public methods

invoke

Added in API level 1
Object invoke (Object proxy, 
                Method method, 
                Object[] args)

Handles the method which was originally invoked on the proxy instance. A typical usage pattern follows below:

 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
     //do some processing before the method invocation

     //invoke the method
     Object result = method.invoke(proxy, args);

     //do some processing after the method invocation
     return result;
 }

Parameters
proxy Object: the proxy instance on which the method was invoked
method Method: the method invoked on the proxy instance
args Object: an array of objects containing the parameters passed to the method, or null if no arguments are expected. Primitive types are boxed.
Returns
Object the result of executing the method. Primitive types are boxed.
Throws
Throwable the exception to throw from the invoked method on the proxy. The exception must match one of the declared exception types of the invoked method or any unchecked exception type. If not then an UndeclaredThrowableException is thrown
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.