org.unitils.mock.core.proxy
Class ProxyUtils

java.lang.Object
  extended by org.unitils.mock.core.proxy.ProxyUtils

public class ProxyUtils
extends java.lang.Object

Utility class to create and work with proxy objects.

Author:
Kenny Claes, Filip Neven, Tim Ducheyne

Constructor Summary
ProxyUtils()
           
 
Method Summary
static java.lang.String getMockName(java.lang.Object object)
           
static java.lang.StackTraceElement[] getProxiedMethodStackTrace()
          First finds a trace element in which a cglib proxy method was invoked.
static java.lang.Class<?> getProxiedTypeIfProxy(java.lang.Object object)
           
static boolean isProxyClassName(java.lang.String className)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyUtils

public ProxyUtils()
Method Detail

getProxiedTypeIfProxy

public static java.lang.Class<?> getProxiedTypeIfProxy(java.lang.Object object)
Parameters:
object - The object to check
Returns:
The proxied type, null if the object is not a proxy

isProxyClassName

public static boolean isProxyClassName(java.lang.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 java.lang.String getMockName(java.lang.Object object)
Parameters:
object - The object to check
Returns:
The proxied type, null if the object is not a proxy or mock

getProxiedMethodStackTrace

public static java.lang.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 © 2009. All Rights Reserved.