public class ThreadContextClassLoaderSupport extends Object
Constructor and Description |
---|
ThreadContextClassLoaderSupport() |
Modifier and Type | Method and Description |
---|---|
static Class<?> |
createStubInThreadContextClassLoader(String className,
Class<?> aClass)
Creates a test implementation or subclass of a given class with a specified name in the current thread context
class-loader.
|
static Memento |
install(ClassLoader classLoader)
Installs a classloader as the current thread context classloader, returning a memento which can be used to
undo the installation.
|
static Memento |
preserve()
Returns a memento to restore the current thread context classloader.
|
public static Memento install(ClassLoader classLoader)
classLoader
- the classloader to install.public static Memento preserve()
public static Class<?> createStubInThreadContextClassLoader(String className, Class<?> aClass)
className
- the name to use for the created class.aClass
- a base class or interface to use as a parent for the specified class.Copyright © 2024. All rights reserved.