org.kuali.rice.core.api.util
Class ContextClassLoaderProxy
java.lang.Object
org.kuali.rice.core.api.util.reflect.BaseInvocationHandler
org.kuali.rice.core.api.util.reflect.BaseTargetedInvocationHandler
org.kuali.rice.core.api.util.ContextClassLoaderProxy
- All Implemented Interfaces:
- InvocationHandler, TargetedInvocationHandler
public class ContextClassLoaderProxy
- extends BaseTargetedInvocationHandler
A Proxy that sets the thread Context ClassLoader before invocation of the
proxied object, and resets it back afterwards.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
Method Summary |
static Class<?>[] |
getInterfacesToProxy(ClassLoader proxyClassLoader,
Object proxiedObject)
Determines the interfaces which need to be proxied and are visable to the given proxy ClassLoader. |
static Class<?>[] |
getInterfacesToProxy(Object proxiedObject)
|
protected Object |
invokeInternal(Object proxy,
Method m,
Object[] args)
|
static Object |
wrap(Object proxiedObject)
|
static Object |
wrap(Object proxiedObject,
Class<?>[] classesToProxy)
|
static Object |
wrap(Object proxiedObject,
Class<?>[] classesToProxy,
ClassLoader classLoader)
|
static Object |
wrap(Object proxiedObject,
Class<?>[] classesToProxy,
ClassLoader proxyClassLoader,
ClassLoader objectClassLoader)
Convenience method that wraps a specified object with a ContextClassLoaderProxy, with a specified
handler classloader and proxy classloader. |
static Object |
wrap(Object proxiedObject,
ClassLoader classLoader)
|
static Object |
wrap(Object proxiedObject,
ClassLoader proxyClassLoader,
ClassLoader objectClassLoader)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ContextClassLoaderProxy
public ContextClassLoaderProxy(ClassLoader classLoader,
Object target)
wrap
public static Object wrap(Object proxiedObject,
Class<?>[] classesToProxy,
ClassLoader proxyClassLoader,
ClassLoader objectClassLoader)
- Convenience method that wraps a specified object with a ContextClassLoaderProxy, with a specified
handler classloader and proxy classloader. If the specified object is null, or the object classloader
equals the proxy classloader, the object is returned unwrapped.
- Parameters:
proxiedObject
- the object to proxyproxyClassLoader
- the classloader OF THE PROXY INSTANCEobjectClassLoader
- the classloader to set as the context classloader prior to any invocations on the proxiedObject
- Returns:
- a ContextClassLoaderProxy Proxy for the proxiedObject
wrap
public static Object wrap(Object proxiedObject,
ClassLoader proxyClassLoader,
ClassLoader objectClassLoader)
wrap
public static Object wrap(Object proxiedObject,
ClassLoader classLoader)
wrap
public static Object wrap(Object proxiedObject,
Class<?>[] classesToProxy)
wrap
public static Object wrap(Object proxiedObject,
Class<?>[] classesToProxy,
ClassLoader classLoader)
wrap
public static Object wrap(Object proxiedObject)
getInterfacesToProxy
public static Class<?>[] getInterfacesToProxy(Object proxiedObject)
getInterfacesToProxy
public static Class<?>[] getInterfacesToProxy(ClassLoader proxyClassLoader,
Object proxiedObject)
- Determines the interfaces which need to be proxied and are visable to the given proxy ClassLoader.
invokeInternal
protected Object invokeInternal(Object proxy,
Method m,
Object[] args)
throws Throwable
- Specified by:
invokeInternal
in class BaseInvocationHandler
- Throws:
Throwable
Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.