Class QuarkusClassLoader.Builder

java.lang.Object
io.quarkus.bootstrap.classloading.QuarkusClassLoader.Builder
Enclosing class:
QuarkusClassLoader

public static class QuarkusClassLoader.Builder extends Object
  • Constructor Details

  • Method Details

    • addElement

      public QuarkusClassLoader.Builder addElement(ClassPathElement element)
      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
    • setResettableElement

      public QuarkusClassLoader.Builder setResettableElement(MemoryClassPathElement resettableElement)
      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

      public QuarkusClassLoader.Builder addParentFirstElement(ClassPathElement element)
      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

      public QuarkusClassLoader.Builder addBannedElement(ClassPathElement element)
      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
    • addLesserPriorityElement

      public QuarkusClassLoader.Builder addLesserPriorityElement(ClassPathElement element)
      Adds an element which will only be used to load a class or resource if no normal 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
    • setAggregateParentResources

      public QuarkusClassLoader.Builder setAggregateParentResources(boolean aggregateParentResources)
      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

      public QuarkusClassLoader.Builder setAssertionsEnabled(boolean assertionsEnabled)
    • setTransformedClasses

      public QuarkusClassLoader.Builder setTransformedClasses(Map<String,byte[]> transformedClasses)
    • addClassLoaderEventListeners

      public QuarkusClassLoader.Builder addClassLoaderEventListeners(List<ClassLoaderEventListener> classLoadListeners)
    • build

      public QuarkusClassLoader build()
      Builds the class loader
      Returns:
      The class loader