Package io.activej.codegen
Class DefiningClassLoader
java.lang.Object
java.lang.ClassLoader
io.activej.codegen.DefiningClassLoader
- All Implemented Interfaces:
DefiningClassLoaderMBean
public final class DefiningClassLoader extends ClassLoader implements DefiningClassLoaderMBean
Represents a loader for defining dynamically generated classes.
Also contains cache, that speeds up loading of classes, which have the same structure as the ones already loaded.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefiningClassLoader.ClassKey -
Method Summary
Modifier and Type Method Description static DefiningClassLoadercreate()static DefiningClassLoadercreate(ClassLoader parent)Class<?>defineAndCacheClass(@Nullable DefiningClassLoader.ClassKey key, String className, byte[] bytecode)Class<?>defineClass(String className, byte[] bytecode)@Nullable Class<?>getCachedClass(@NotNull DefiningClassLoader.ClassKey key)intgetCachedClassesCount()Map<String,Long>getCachedClassesCountByType()intgetDefinedClassesCount()StringtoString()Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Method Details
-
create
-
create
-
defineClass
-
defineAndCacheClass
public Class<?> defineAndCacheClass(@Nullable @Nullable DefiningClassLoader.ClassKey key, String className, byte[] bytecode) -
getCachedClass
@Nullable public @Nullable Class<?> getCachedClass(@NotNull @NotNull DefiningClassLoader.ClassKey key) -
getDefinedClassesCount
public int getDefinedClassesCount()- Specified by:
getDefinedClassesCountin interfaceDefiningClassLoaderMBean
-
getCachedClassesCount
public int getCachedClassesCount()- Specified by:
getCachedClassesCountin interfaceDefiningClassLoaderMBean
-
getCachedClassesCountByType
- Specified by:
getCachedClassesCountByTypein interfaceDefiningClassLoaderMBean
-
toString
-