Class ShrinkWrapClassLoader

java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.jboss.shrinkwrap.api.classloader.ShrinkWrapClassLoader
All Implemented Interfaces:
Closeable, AutoCloseable

public class ShrinkWrapClassLoader extends URLClassLoader implements Closeable
Extension that will create a ClassLoader based on a Array of Archives. When done, call close() to free resources.
  • Field Details

    • log

      private static final Logger log
      Logger
    • EMPTY

      private static final String EMPTY
      Empty String
      See Also:
    • openedStreams

      private final List<InputStream> openedStreams
      List of all streams opened, such that they may be closed in close(). Guarded by "this".
  • Constructor Details

    • ShrinkWrapClassLoader

      public ShrinkWrapClassLoader(Archive<?>... archives)
      Constructs a new ShrinkWrapClassLoader for the specified Archives using the default delegation parent ClassLoader. The Archives will be searched in the order specified for classes and resources after first searching in the parent class loader.
      Parameters:
      archives - the Archives from which to load classes and resources
    • ShrinkWrapClassLoader

      public ShrinkWrapClassLoader(ClassLoader parent, Archive<?>... archives)
      Constructs a new ShrinkWrapClassLoader for the given Archives. The Archives will be searched in the order specified for classes and resources after first searching in the specified parent class loader.
      Parameters:
      parent - the parent class loader for delegation
      archives - the Archives from which to load classes and resources
  • Method Details