org.easetech.easytest.interceptor
Interface MethodIntercepter

All Known Implementing Classes:
DefaultMethodIntercepter

public interface MethodIntercepter

Interface that provides the users with the ability to intercept methods on class instances that are marked with Intercept annotations. The user can provide the implementation of this interface as attribute to the Intercept annotation. Note: If you are using DataDrivenTestRunner, then CGLib is being used to intercept method invocation behind the scene. Look at InternalInterceptor class for more detail. If you are using SpringTestRunner from the easytest-spring module, then Spring AOP is being used to intercept method invocation behind the scene.You can look at SpringInternalIntercepter class in the easytest-spring module for more detail.

Author:
Anuj Kumar

Method Summary
 Object intercept(Method methodToIntercept, Object targetInstance, Object[] methodArgs)
          Intercept the method invocation on the target class.
 

Method Detail

intercept

Object intercept(Method methodToIntercept,
                 Object targetInstance,
                 Object[] methodArgs)
                 throws Throwable
Intercept the method invocation on the target class. To be used for providing before and after advice when a given method is executed.

Parameters:
methodToIntercept - the method to intercept
targetInstance - the target instance on which to call the method
methodArgs - the arguments to the method
Returns:
object
Throws:
Throwable - if any exception occurs


Copyright © 2013. All Rights Reserved.