org.kuali.rice.core.util
Class ClassLoaderUtils

java.lang.Object
  extended by org.kuali.rice.core.util.ClassLoaderUtils

public class ClassLoaderUtils
extends Object

Provides common utility methods for dealing with Classloaders.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
private static org.apache.log4j.Logger LOG
           
 
Constructor Summary
ClassLoaderUtils()
           
 
Method Summary
static Class getClass(String className)
           
static ClassLoader getDefaultClassLoader()
          Returns the default class loader within the current context.
static Class[] getInterfacesToProxy(Object object, ClassLoader proxyClassLoader, String[] packageNamesToFilter)
          Determines the interfaces which need to be proxied and are visible to the given proxy ClassLoader.
static boolean isClassVisible(ClassLoader classLoader, Class classToCheck)
          Checks if the given Class is visible to the given ClassLoader.
static boolean isInstanceOf(Object object, Class instanceClass)
          Checks if the given object is an instance of the given class, unwrapping any proxies if necessary to get to the underlying object.
static Object unwrapFromProxy(Object proxy)
           
private static Object unwrapFromProxyOnce(Object proxy)
          Unwraps the underlying object from the given proxy (which may itself be a proxy).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG
Constructor Detail

ClassLoaderUtils

public ClassLoaderUtils()
Method Detail

getDefaultClassLoader

public static ClassLoader getDefaultClassLoader()
Returns the default class loader within the current context. If there is a context classloader it is returned, otherwise the classloader which loaded the ClassLoaderUtil Class is returned.

Returns:
the appropriate default classloader which is guaranteed to be non-null

isInstanceOf

public static boolean isInstanceOf(Object object,
                                   Class instanceClass)
Checks if the given object is an instance of the given class, unwrapping any proxies if necessary to get to the underlying object.


unwrapFromProxy

public static Object unwrapFromProxy(Object proxy)

unwrapFromProxyOnce

private static Object unwrapFromProxyOnce(Object proxy)
Unwraps the underlying object from the given proxy (which may itself be a proxy). If the given object is not a valid proxy, then null is returned.


isClassVisible

public static boolean isClassVisible(ClassLoader classLoader,
                                     Class classToCheck)
Checks if the given Class is visible to the given ClassLoader.


getInterfacesToProxy

public static Class[] getInterfacesToProxy(Object object,
                                           ClassLoader proxyClassLoader,
                                           String[] packageNamesToFilter)
Determines the interfaces which need to be proxied and are visible to the given proxy ClassLoader.


getClass

public static Class getClass(String className)


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.