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
Extension that will create a ClassLoader based on a Array of Archives. When done, call
close() to free resources.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringEmpty Stringprivate static final LoggerLoggerprivate final List<InputStream> List of all streams opened, such that they may be closed inclose(). -
Constructor Summary
ConstructorsConstructorDescriptionShrinkWrapClassLoader(ClassLoader parent, Archive<?>... archives) Constructs a new ShrinkWrapClassLoader for the givenArchives.ShrinkWrapClassLoader(Archive<?>... archives) Constructs a new ShrinkWrapClassLoader for the specifiedArchives using the default delegation parentClassLoader. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddArchive(Archive<?> archive) private voidaddArchives(Archive<?>[] archives) voidclose()Methods inherited from class URLClassLoader
addURL, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstanceMethods inherited from class SecureClassLoader
defineClass, defineClassMethods inherited from class ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
log
Logger -
EMPTY
-
openedStreams
List of all streams opened, such that they may be closed inclose(). Guarded by "this".
-
-
Constructor Details
-
ShrinkWrapClassLoader
Constructs a new ShrinkWrapClassLoader for the specifiedArchives using the default delegation parentClassLoader. TheArchives will be searched in the order specified for classes and resources after first searching in the parent class loader.- Parameters:
archives- theArchives from which to load classes and resources
-
ShrinkWrapClassLoader
Constructs a new ShrinkWrapClassLoader for the givenArchives. TheArchives 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 delegationarchives- theArchives from which to load classes and resources
-
-
Method Details
-
addArchives
-
addArchive
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classURLClassLoader- Throws:
IOException
-