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, callclose()to free resources.- Author:
- Aslak Knutsen, ALR
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()-
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
-
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
-
Methods inherited from class java.lang.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 Detail
-
ShrinkWrapClassLoader
public ShrinkWrapClassLoader(Archive<?>... archives)
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
public ShrinkWrapClassLoader(ClassLoader parent, Archive<?>... archives)
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 Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classURLClassLoader- Throws:
IOException
-
-