org.unitils.mock.core.proxy
Class ProxyUtils
java.lang.Object
org.unitils.mock.core.proxy.ProxyUtils
public class ProxyUtils
- extends Object
Utility class to create and work with proxy objects.
- Author:
- Kenny Claes, Filip Neven, Tim Ducheyne
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ProxyUtils
public ProxyUtils()
getProxiedTypeIfProxy
public static Class<?> getProxiedTypeIfProxy(Object object)
- Parameters:
object
- The object to check
- Returns:
- The proxied type, null if the object is not a proxy
isProxy
public static boolean isProxy(Object instance)
- Parameters:
instance
- The instance to check, not null
- Returns:
- True if the given instance is a jdk or cglib proxy
isProxyClassName
public static boolean isProxyClassName(String className)
- Parameters:
className
- The class name to check, not null
- Returns:
- True if the given class name is cglib proxy class name
getMockName
public static String getMockName(Object object)
- note: don't remove, used through reflection from
ObjectFormatter
- Parameters:
object
- The object to check
- Returns:
- The proxied type, null if the object is not a proxy or mock
getProxiedMethodStackTrace
public static StackTraceElement[] getProxiedMethodStackTrace()
- First finds a trace element in which a cglib proxy method was invoked. Then it returns the rest of the stack trace following that
element. The stack trace starts with the element rh r is the method call that was proxied by the proxy method.
- Returns:
- The proxied method trace, not null
Copyright © 2011. All Rights Reserved.