Class ClassFileLoader

java.lang.Object
de.inetsoftware.jwebassembly.module.ClassFileLoader

public class ClassFileLoader extends Object
Cache and manager for the loaded ClassFiles
  • Field Details

  • Constructor Details

    • ClassFileLoader

      public ClassFileLoader(ClassLoader loader)
      Create a new instance
      Parameters:
      loader - the classloader to find the *.class files
  • Method Details

    • get

      @Nullable public ClassFile get(String className) throws IOException
      Get the ClassFile from cache or load it.
      Parameters:
      className - the class name like "java/lang/Object"
      Returns:
      the ClassFile or null
      Throws:
      IOException - If any I/O error occur
    • cache

      public void cache(@Nonnull ClassFile classFile)
      Add a class file to the weak cache.
      Parameters:
      classFile - the class file
    • replace

      void replace(String className, ClassFile classFile)
      Replace the class in the cache with the given instance to the loader cache.
      Parameters:
      className - the name of the class to replace
      classFile - the replacing ClassFile
    • partial

      void partial(String className, ClassFile partialClassFile) throws IOException
      Add a partial class with the given instance to the loader cache.
      Parameters:
      className - the name of the class to replace like "java/lang/String"
      partialClassFile - the partial ClassFile
      Throws:
      IOException - If any I/O error occur