org.apache.felix.ipojo
Interface MethodInterceptor

All Known Implementing Classes:
ArchitectureHandler, ConfigurationHandler, ControllerHandler, Dependency, DependencyHandler, LifecycleCallbackHandler, PrimitiveHandler, ProvidedServiceHandler

public interface MethodInterceptor

Method interceptor. A class implementing this interface is able to be notified of method invocation. The listener need to be register on the instance manager. For event are send to the listener : before the method entry, after the method returns, when an error is thrown by the method, and before the after either a returns or an error (finally)

Author:
Felix Project Team

Method Summary
 void onEntry(java.lang.Object pojo, java.lang.reflect.Method method, java.lang.Object[] args)
          This method is called when the execution enter in a method.
 void onError(java.lang.Object pojo, java.lang.reflect.Method method, java.lang.Throwable throwable)
          This method is called when the execution throw an exception in the given method.
 void onExit(java.lang.Object pojo, java.lang.reflect.Method method, java.lang.Object returnedObj)
          This method is called when the execution exit a method (before a return or a throw).
 void onFinally(java.lang.Object pojo, java.lang.reflect.Method method)
          This method is called when the execution of a method will terminate : just before to throw an exception or before to return.
 

Method Detail

onEntry

void onEntry(java.lang.Object pojo,
             java.lang.reflect.Method method,
             java.lang.Object[] args)
This method is called when the execution enter in a method.

Parameters:
pojo - : pojo on which the method is called.
method - : method invoked.
args - arguments array.

onExit

void onExit(java.lang.Object pojo,
            java.lang.reflect.Method method,
            java.lang.Object returnedObj)
This method is called when the execution exit a method (before a return or a throw). If the given returned object is null, either the method is void, either it returns null. You must not modified the returned object.

Parameters:
pojo - : the pojo on which the method exits.
method - : exiting method.
returnedObj - : the returned object (boxed for primitive type)

onError

void onError(java.lang.Object pojo,
             java.lang.reflect.Method method,
             java.lang.Throwable throwable)
This method is called when the execution throw an exception in the given method.

Parameters:
pojo - : the pojo on which the method was accessed.
method - : invoked method.
throwable - : the thrown exception

onFinally

void onFinally(java.lang.Object pojo,
               java.lang.reflect.Method method)
This method is called when the execution of a method will terminate : just before to throw an exception or before to return. OnError or OnExit was already called.

Parameters:
pojo - : the pojo on which the method was accessed.
method - : invoked method.