Top Description Constructors Methods
org.junit.platform.commons.util

public final Class ClassLoaderUtils

extends Object
Class Inheritance
Annotations
@API
status:INTERNAL
since:1.0
Static Imports
org.apiguardian.api.API.Status.INTERNAL

Collection of utilities for working with ClassLoader and associated tasks.

DISCLAIMER

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!

Since
1.0

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ClassLoader
getClassLoader(Class<?>
the class for which to retrieve the class loader; never null
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.

public static ClassLoader
public static Optional<URL>

Returns:

an Optional containing the URL of the class' location; never null but potentially empty
getLocation
(Object
the object for whose class the location should be retrieved
object
)

Get the location from which the supplied object's class was loaded.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ClassLoaderUtilsback to summary
private ClassLoaderUtils()

Method Detail

getClassLoaderback to summary
public static ClassLoader getClassLoader(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.

Parameters
clazz:Class<?>

the class for which to retrieve the class loader; never null

Since
1.10
getDefaultClassLoaderback to summary
public static ClassLoader getDefaultClassLoader()
getLocationback to summary
public static Optional<URL> getLocation(Object object)

Get the location from which the supplied object's class was loaded.

Parameters
object:Object

the object for whose class the location should be retrieved

Returns:Optional<URL>

an Optional containing the URL of the class' location; never null but potentially empty