Class QuarkusClassLoader.Builder
- Enclosing class:
- QuarkusClassLoader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddBannedElement(ClassPathElement element) Adds an element that contains classes that should never be loaded by this loader.addClassLoaderEventListeners(List<ClassLoaderEventListener> classLoadListeners) addLesserPriorityElement(ClassPathElement element) Adds an element which will only be used to load a class or resource if no normal priority element containing that class or resource exists.addNormalPriorityElement(ClassPathElement element) Adds an element that can be used to load classes.addParentFirstElement(ClassPathElement element) Adds an element that contains classes that will always be loaded in a parent first manner.build()Builds the class loadersetAggregateParentResources(boolean aggregateParentResources) If this is true then a getResources call will always include the parent resources.setAssertionsEnabled(boolean assertionsEnabled) setResettableElement(MemoryClassPathElement resettableElement) Adds a resettable MemoryClassPathElement to the class loader.setTransformedClasses(Map<String, byte[]> transformedClasses) toString()
-
Constructor Details
-
Builder
-
-
Method Details
-
addNormalPriorityElement
Adds an element that can be used to load classes.Order is important, if there are multiple elements that provide the same class then the first one passed to this method will be used.
The provided element will be closed when the ClassLoader is closed.
- Parameters:
element- The element to add- Returns:
- This builder
-
addLesserPriorityElement
Adds an element which will only be used to load a class or resource if no normal priority element containing that class or resource exists. This is used in order control the order of elements when multiple contain the same classes- Parameters:
element- The element to add- Returns:
- This builder
-
setResettableElement
Adds a resettable MemoryClassPathElement to the class loader.This element is mutable, and its contents will be modified if the class loader is reset.
If this is not explicitly added to the elements list then it will be automatically added as the highest priority element.
- Parameters:
resettableElement- The element- Returns:
- This builder
-
addParentFirstElement
Adds an element that contains classes that will always be loaded in a parent first manner.Note that this does not mean that the parent will always have this class, it is possible that in some cases the class will end up being loaded by this loader, however an attempt will always be made to load these from the parent CL first
Note that elements passed to this method will not be automatically closed, as references to this element are not retained after the class loader has been built.
- Parameters:
element- The element to add- Returns:
- This builder
-
addBannedElement
Adds an element that contains classes that should never be loaded by this loader.Note that elements passed to this method will not be automatically closed, as references to this element are not retained after the class loader has been built.
This is because banned elements are generally expected to be loaded by another ClassLoader, so this prevents the need to create multiple ClassPathElements for the same resource.
Banned elements have the highest priority, a banned element will never be loaded, and resources will never appear to be present.
- Parameters:
element- The element to add- Returns:
- This builder
-
setAggregateParentResources
If this is true then a getResources call will always include the parent resources.If this is false then getResources will not return parent resources if local resources were found.
This only takes effect if parentFirst is false.
-
setAssertionsEnabled
-
setTransformedClasses
-
addClassLoaderEventListeners
public QuarkusClassLoader.Builder addClassLoaderEventListeners(List<ClassLoaderEventListener> classLoadListeners) -
build
Builds the class loader- Returns:
- The class loader
-
toString
-