Class QuarkusClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- io.quarkus.bootstrap.classloading.QuarkusClassLoader
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class QuarkusClassLoader extends ClassLoader implements Closeable
The ClassLoader used for non production Quarkus applications (i.e. dev and test mode).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQuarkusClassLoader.Builder
-
Field Summary
Fields Modifier and Type Field Description protected static StringJAVAprotected static StringMETA_INF_SERVICES
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCloseTask(Runnable task)static QuarkusClassLoader.Builderbuilder(String name, ClassLoader parent, boolean parentFirst)voidclose()protected Class<?>findClass(String moduleName, String name)This method is needed to make packages work correctly on JDK9+, as it will be called to load the package-info class.static List<ClassPathElement>getElements(String resourceName, boolean localOnly)List<ClassPathElement>getElementsWithResource(String name)List<ClassPathElement>getElementsWithResource(String name, boolean localOnly)List<String>getLocalClassNames()StringgetName()URLgetResource(String unsanitisedName)InputStreamgetResourceAsStream(String unsanitisedName)Enumeration<URL>getResources(String unsanitisedName)Enumeration<URL>getResources(String unsanitisedName, boolean parentAlreadyFoundResources)booleanisClosed()booleanisParentFirst(String name)Returns true if the supplied class is a class that would be loaded parent-firstClass<?>loadClass(String name)protected Class<?>loadClass(String name, boolean resolve)ClassLoaderparent()voidreset(Map<String,byte[]> generatedResources, Map<String,byte[]> transformedClasses)StringtoString()Class<?>visibleDefineClass(String name, byte[] b, int off, int len)-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Field Detail
-
META_INF_SERVICES
protected static final String META_INF_SERVICES
- See Also:
- Constant Field Values
-
JAVA
protected static final String JAVA
- See Also:
- Constant Field Values
-
-
Method Detail
-
getElements
public static List<ClassPathElement> getElements(String resourceName, boolean localOnly)
-
builder
public static QuarkusClassLoader.Builder builder(String name, ClassLoader parent, boolean parentFirst)
-
isParentFirst
public boolean isParentFirst(String name)
Returns true if the supplied class is a class that would be loaded parent-first
-
reset
public void reset(Map<String,byte[]> generatedResources, Map<String,byte[]> transformedClasses)
-
getResources
public Enumeration<URL> getResources(String unsanitisedName) throws IOException
- Overrides:
getResourcesin classClassLoader- Throws:
IOException
-
getResources
public Enumeration<URL> getResources(String unsanitisedName, boolean parentAlreadyFoundResources) throws IOException
- Throws:
IOException
-
getResource
public URL getResource(String unsanitisedName)
- Overrides:
getResourcein classClassLoader
-
getResourceAsStream
public InputStream getResourceAsStream(String unsanitisedName)
- Overrides:
getResourceAsStreamin classClassLoader
-
findClass
protected Class<?> findClass(String moduleName, String name)
This method is needed to make packages work correctly on JDK9+, as it will be called to load the package-info class.- Overrides:
findClassin classClassLoader- Parameters:
moduleName-name-- Returns:
-
loadClass
public Class<?> loadClass(String name) throws ClassNotFoundException
- Overrides:
loadClassin classClassLoader- Throws:
ClassNotFoundException
-
loadClass
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
- Overrides:
loadClassin classClassLoader- Throws:
ClassNotFoundException
-
getElementsWithResource
public List<ClassPathElement> getElementsWithResource(String name)
-
getElementsWithResource
public List<ClassPathElement> getElementsWithResource(String name, boolean localOnly)
-
visibleDefineClass
public Class<?> visibleDefineClass(String name, byte[] b, int off, int len) throws ClassFormatError
- Throws:
ClassFormatError
-
addCloseTask
public void addCloseTask(Runnable task)
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
isClosed
public boolean isClosed()
-
parent
public ClassLoader parent()
-
getName
public String getName()
- Overrides:
getNamein classClassLoader
-
-