Class ModuleLayerFromSingleClassLoaderDecorator
java.lang.Object
net.bytebuddy.dynamic.loading.ModuleLayerFromSingleClassLoaderDecorator
- All Implemented Interfaces:
ClassLoaderDecorator
@Enhance
public class ModuleLayerFromSingleClassLoaderDecorator
extends Object
implements ClassLoaderDecorator
A simple implementation of a
ClassLoaderDecorator that creates module layers for dynamically
generated types using the Java Module System. The module information is resolved from a provided
module-info class. Without such a class, the decoration is omitted.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn abstract implementation of a module finder that can locate specific modules.static classAn abstract implementation of a module reader that provides access to dynamically generated types.protected static interfaceA proxy for thejava.lang.module.Configurationtype.static enumA factory for creating a single module from amodule-infoclass file, if available.protected static interfaceA proxy for thejava.lang.module.ModuleDescriptortype.protected static interfaceA proxy for thejava.lang.module.ModuleFindertype.protected static interfaceA proxy for thejava.lang.ModuleLayertype.protected static interfaceA proxy for thejava.lang.ModuleLayer.Controllertype.protected static interfaceA proxy for thejava.util.Optionaltype.protected static interfaceA proxy for thejava.nio.file.Pathtype.protected static interfaceA proxy for the dynamically generatedSimpleModuleFindertype.protected static interfaceA proxy for the dynamically generatedSimpleModuleReferencetype.protected static interfaceA proxy for thejava.util.stream.Streamtype.Nested classes/interfaces inherited from interface ClassLoaderDecorator
ClassLoaderDecorator.NoOp -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedModuleLayerFromSingleClassLoaderDecorator(ClassLoader classLoader, Object moduleLayer, String name, Set<String> packages) Creates a new module layer from module info decorator. -
Method Summary
Modifier and TypeMethodDescriptionapply(TypeDescription typeDescription) Applies this decorator to resolve a class loader for the given type.booleanisSkipped(TypeDescription typeDescription) Determines if a type should be skipped from class loader decoration.
-
Constructor Details
-
ModuleLayerFromSingleClassLoaderDecorator
protected ModuleLayerFromSingleClassLoaderDecorator(@MaybeNull ClassLoader classLoader, Object moduleLayer, String name, Set<String> packages) Creates a new module layer from module info decorator.- Parameters:
classLoader- The class loader to delegate to when types are not handled by the module layer.moduleLayer- The module layer containing the dynamically created module.name- The name of the module within the module layer.packages- The packages that are exported by the module.
-
-
Method Details
-
isSkipped
Determines if a type should be skipped from class loader decoration.- Specified by:
isSkippedin interfaceClassLoaderDecorator- Parameters:
typeDescription- The type description to check.- Returns:
trueif the type should be skipped from decoration.
-
apply
Applies this decorator to resolve a class loader for the given type.- Specified by:
applyin interfaceClassLoaderDecorator- Parameters:
typeDescription- The type description for which to resolve a class loader.- Returns:
- The class loader to use for the given type or
nullfor the bootstrap class loader.
-