org.apache.felix.ipojo

## Interface MethodInterceptor

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

    public interface MethodInterceptor

Method interceptor. A class implementing this interface is able to be notified of method invocations ( i.e. entries, exits, and errors). The listener needs to be register on the instance manager with the `InstanceManager.register(org.apache.felix.ipojo.parser.MethodMetadata, MethodInterceptor)` method. Events are sent before the method entry (onEntry), after the method returns (onExit), when an error is thrown by the method (onError), and before the after either a returns or an error (onFinally). Instead of a `Method` object, the callbacks received a `Member` object which can be either a `Method` or a `Constructor`.

Author:
  Felix Project Team

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `onEntry(java.lang.Object pojo, java.lang.reflect.Member method, java.lang.Object[] args)` This method is called when a thread enters in a method.
`void` `onError(java.lang.Object pojo, java.lang.reflect.Member method, java.lang.Throwable throwable)` This method is called when the execution throws an exception in the given method.
`void` `onExit(java.lang.Object pojo, java.lang.reflect.Member method, java.lang.Object returnedObj)` This method is called when the execution exits a method : before a `return`.
`void` `onFinally(java.lang.Object pojo, java.lang.reflect.Member method)` This method is called when the execution of a method is going to terminate : just before to throw an exception or before to return.

### Method Detail

#### onEntry

    void onEntry(java.lang.Object pojo,
                 java.lang.reflect.Member method,
                 java.lang.Object[] args)

This method is called when a thread enters in a method. The given argument array is created from the method argument.

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

#### onExit

    void onExit(java.lang.Object pojo,
                java.lang.reflect.Member method,
                java.lang.Object returnedObj)

This method is called when the execution exits a method : before a `return`. If the given returned object is `null`, either the method is `void`, or it returns `null`. This method must not modify the returned object.

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

#### onError

    void onError(java.lang.Object pojo,
                 java.lang.reflect.Member method,
                 java.lang.Throwable throwable)

This method is called when the execution throws an exception in the given method.

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

#### onFinally

    void onFinally(java.lang.Object pojo,
                   java.lang.reflect.Member method)

This method is called when the execution of a method is going to 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` - the invoked method.