@API(status=INTERNAL,
since="1.0")
public final class ClassLoaderUtils
extends java.lang.Object
These utilities are intended solely for usage within the JUnit framework itself. Any usage by external parties is not supported. Use at your own risk!
| Modifier | Constructor and Description |
|---|---|
private |
ClassLoaderUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.ClassLoader |
getClassLoader(java.lang.Class<?> clazz)
Get the
ClassLoader for the supplied Class, falling back
to the default class loader if the class
loader for the supplied class is null. |
static java.lang.ClassLoader |
getDefaultClassLoader() |
static java.util.Optional<java.net.URL> |
getLocation(java.lang.Object object)
Get the location from which the supplied object's class was loaded.
|
public static java.lang.ClassLoader getClassLoader(java.lang.Class<?> clazz)
ClassLoader for the supplied Class, falling back
to the default class loader if the class
loader for the supplied class is null.clazz - the class for which to retrieve the class loader; never nullpublic static java.lang.ClassLoader getDefaultClassLoader()
public static java.util.Optional<java.net.URL> getLocation(java.lang.Object object)
object - the object for whose class the location should be retrievedOptional containing the URL of the class' location; never
null but potentially empty