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 java.lang.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(java.lang.String mockName,
java.lang.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 java.lang.Object intercept(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] arguments,
net.sf.cglib.proxy.MethodProxy methodProxy)
throws java.lang.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:
java.lang.Throwable
getMockName
public java.lang.String getMockName()
getProxiedType
public java.lang.Class<?> getProxiedType()
- Returns:
- The proxied type, not null
Copyright © 2009. All Rights Reserved.