org.kuali.rice.core.api.util
Class ClassLoaderUtils

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

public final class ClassLoaderUtils
extends Object

Provides common utility methods for dealing with Classloaders.

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

Method Summary
static Class<?> getClass(String className)
           
static
<T> Class<? extends T>
getClass(String className, Class<T> type)
           
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)

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)

getClass

public static <T> Class<? extends T> getClass(String className,
                                              Class<T> type)
                                   throws ClassNotFoundException
Throws:
ClassNotFoundException


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.