org.apache.felix.ipojo
Interface MethodInterceptor

All Known Implementing Classes:
ArchitectureHandler, ConfigurationHandler, ControllerHandler, Dependency, DependencyHandler, EventAdminPublisherHandler, EventAdminSubscriberHandler, ExtenderModelHandler, LifecycleCallbackHandler, MBeanHandler, PrimitiveHandler, ProvidedServiceHandler, TemporalDependency, TemporalHandler, TransactionHandler, TransactionnalMethod, WhiteBoardPatternHandler

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)

Author:
Felix Project Team

Method Summary
 void onEntry(Object pojo, Method method, Object[] args)
          This method is called when a thread enters in a method.
 void onError(Object pojo, Method method, Throwable throwable)
          This method is called when the execution throws an exception in the given method.
 void onExit(Object pojo, Method method, Object returnedObj)
          This method is called when the execution exits a method : before a return.
 void onFinally(Object pojo, Method 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(Object pojo,
             Method method,
             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(Object pojo,
            Method method,
            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(Object pojo,
             Method method,
             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(Object pojo,
               Method 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.


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.