org.easetech.easytest.interceptor
Class InternalInvocationhandler

java.lang.Object
  extended by org.easetech.easytest.interceptor.InternalInvocationhandler
All Implemented Interfaces:
InvocationHandler

public class InternalInvocationhandler
extends Object
implements InvocationHandler

implementation of the InvocationHandler interface for internal usage. This is used when the user has Provided annotation on a field whose type is an Interface. EasyTest uses JDK dynamic proxies to intercept calls to the method on Interface type fields. For Concrete classes, EasyTest uses CGLIB.

Author:
Anuj Kumar

Constructor Summary
InternalInvocationhandler()
           
 
Method Summary
 Object getTargetInstance()
           
 MethodIntercepter getUserIntercepter()
           
 Object invoke(Object proxy, Method method, Object[] args)
          Invoke the method on the provided targetInstance.
 void setTargetInstance(Object targetInstance)
           
 void setUserIntercepter(MethodIntercepter userIntercepter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternalInvocationhandler

public InternalInvocationhandler()
Method Detail

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Invoke the method on the provided targetInstance. userIntercepter's intercept method is invoked with the right arguments. Note that this implementation does not use the proxy instance passed to this method.

Specified by:
invoke in interface InvocationHandler
Parameters:
proxy - NOT USED
method - the method to invoke
args - the arguments to the method
Returns:
object
Throws:
Throwable - if any exception occurs

getUserIntercepter

public MethodIntercepter getUserIntercepter()
Returns:
the userIntercepter

setUserIntercepter

public void setUserIntercepter(MethodIntercepter userIntercepter)
Parameters:
userIntercepter - the userIntercepter to set

getTargetInstance

public Object getTargetInstance()
Returns:
the targetInstance

setTargetInstance

public void setTargetInstance(Object targetInstance)
Parameters:
targetInstance - the targetInstance to set


Copyright © 2013. All Rights Reserved.