org.unitils.mock.core.proxy
Class CglibProxyMethodInterceptor<T>
java.lang.Object
org.unitils.mock.core.proxy.CglibProxyMethodInterceptor<T>
- All Implemented Interfaces:
- net.sf.cglib.proxy.Callback, net.sf.cglib.proxy.MethodInterceptor
public class CglibProxyMethodInterceptor<T>
- extends Object
- implements net.sf.cglib.proxy.MethodInterceptor
A cglib method intercepter that will delegate the invocations to the given invocation hanlder.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CglibProxyMethodInterceptor
public CglibProxyMethodInterceptor(String mockName,
Class<T> proxiedType,
ProxyInvocationHandler invocationHandler)
- Creates an interceptor.
- Parameters:
mockName
- The name of the mock, not nullproxiedType
- The proxied type, not nullinvocationHandler
- The handler to delegate the invocations to, not null
intercept
public Object intercept(Object proxy,
Method method,
Object[] arguments,
net.sf.cglib.proxy.MethodProxy methodProxy)
throws Throwable
- Intercepts the method call by wrapping the invocation in a
CglibProxyMethodInterceptor.CglibProxyInvocation
and delegating the
handling to the invocation handler.
- Specified by:
intercept
in interface net.sf.cglib.proxy.MethodInterceptor
- Parameters:
proxy
- The proxy, not nullmethod
- The method that was called, not nullarguments
- The arguments that were used, not nullmethodProxy
- The cglib method proxy, not null
- Returns:
- The value to return for the method call, ignored for void methods
- Throws:
Throwable
getMockName
public String getMockName()
getProxiedType
public Class<?> getProxiedType()
- Returns:
- The proxied type, not null
Copyright © 2011. All Rights Reserved.