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 an Array of Archives. When done, call
close() to free resources.- Author:
- Aslak Knutsen, ALR
-
Constructor Summary
ConstructorsConstructorDescriptionShrinkWrapClassLoader(ClassLoader parent, String classPrefix, Archive<?>... archives) Constructs a new ShrinkWrapClassLoader for the givenArchives.ShrinkWrapClassLoader(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
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, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
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. Will assume classes are stored relative to the root of the archive.- 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. Will assume classes are stored relative to the root of the archive.- Parameters:
parent- the parent class loader for delegationarchives- 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 delegationclassPrefix- The location under which classes are located in the archive. For instance,WebArchivetypes store their classes under WEB-INF/classes. If null, assumes the rootarchives- theArchives from which to load classes and resources
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classURLClassLoader
-