Package net.bytebuddy.dynamic
Class ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.ForDelegatingClassLoader
java.lang.Object
net.bytebuddy.dynamic.ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.Default
net.bytebuddy.dynamic.ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.ForDelegatingClassLoader
- All Implemented Interfaces:
ClassFileLocator.ForInstrumentation.ClassLoadingDelegate
- Enclosing interface:
- ClassFileLocator.ForInstrumentation.ClassLoadingDelegate
public static class ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.ForDelegatingClassLoader
extends ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.Default
A class loading delegate that accounts for a
sun.reflect.DelegatingClassLoader
which
cannot load its own classes by name.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class net.bytebuddy.dynamic.ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.Default
ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.Default.BootLoaderProxyCreationAction
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.ClassFileLocator.ForInstrumentation.ClassLoadingDelegate
ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.Default, ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.Explicit, ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.ForDelegatingClassLoader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
The name of the delegating class loader.private static final ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.ForDelegatingClassLoader.Dispatcher.Initializable
A dispatcher for extracting a class loader's loaded classes.private static final int
An index indicating the first element of a collection.Fields inherited from class net.bytebuddy.dynamic.ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.Default
classLoader
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ForDelegatingClassLoader
(ClassLoader classLoader) Creates a class loading delegate for a delegating class loader. -
Method Summary
Modifier and TypeMethodDescriptionprivate static <T> T
doPrivileged
(PrivilegedAction<T> action) A proxy forjava.security.AccessController#doPrivileged
that is activated if available.protected static boolean
isDelegating
(ClassLoader classLoader) Checks if a class loader is a delegating class loader.Class<?>
Loads a class by its name.Methods inherited from class net.bytebuddy.dynamic.ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.Default
getClassLoader, of
-
Field Details
-
DELEGATING_CLASS_LOADER_NAME
The name of the delegating class loader.- See Also:
-
ONLY
private static final int ONLYAn index indicating the first element of a collection.- See Also:
-
DISPATCHER
private static final ClassFileLocator.ForInstrumentation.ClassLoadingDelegate.ForDelegatingClassLoader.Dispatcher.Initializable DISPATCHERA dispatcher for extracting a class loader's loaded classes.
-
-
Constructor Details
-
ForDelegatingClassLoader
Creates a class loading delegate for a delegating class loader.- Parameters:
classLoader
- The delegating class loader.
-
-
Method Details
-
doPrivileged
A proxy forjava.security.AccessController#doPrivileged
that is activated if available.- Type Parameters:
T
- The type of the action's resolved value.- Parameters:
action
- The action to execute from a privileged context.- Returns:
- The action's resolved value.
-
isDelegating
Checks if a class loader is a delegating class loader.- Parameters:
classLoader
- The class loader to inspect ornull
to check the boot loader.- Returns:
true
if the class loader is a delegating class loader.
-
locate
Loads a class by its name.- Specified by:
locate
in interfaceClassFileLocator.ForInstrumentation.ClassLoadingDelegate
- Overrides:
locate
in classClassFileLocator.ForInstrumentation.ClassLoadingDelegate.Default
- Parameters:
name
- The name of the type.- Returns:
- The class with the given name.
- Throws:
ClassNotFoundException
- If a class cannot be found.
-