类 BytecodeCompiler

java.lang.Object
cn.taketoday.bytecode.BytecodeCompiler
直接已知子类:
SpelCompiler

public class BytecodeCompiler extends Object
从以下版本开始:
4.0 2021/11/29 11:23
作者:
Harry Yang
  • 字段详细资料

    • childClassLoader

      protected volatile cn.taketoday.bytecode.BytecodeCompiler.ChildClassLoader childClassLoader
  • 构造器详细资料

  • 方法详细资料

    • compile

      public <T> Class<T> compile(String className, byte[] classFile)
      类型参数:
      T - class type
      参数:
      className - class full name like 'cn.taketoday.xxx'
      classFile - class byte-code data
      返回:
      Class
    • compile

      public <T> Class<T> compile(byte[] classFile)
      类型参数:
      T - class type
      参数:
      classFile - class byte-code data
      返回:
      Class
    • loadClass

      protected <T> Class<T> loadClass(String name, byte[] classFile)
      Load a class. Makes sure the classloaders aren't used too much because they anchor compiled classes in memory and prevent GC. If you have expressions continually recompiling over time then by replacing the classloader periodically at least some of the older variants can be garbage collected.
      参数:
      name - the name of the class
      classFile - the bytecode for the class
      返回:
      the Class object for the compiled expression
    • getCompiler

      public static BytecodeCompiler getCompiler(@Nullable ClassLoader classLoader)
      Factory method for compiler instances. The returned BytecodeCompiler will attach a class loader as the child of the given class loader and this child will be used to load compiled expressions.
      参数:
      classLoader - the ClassLoader to use as the basis for compilation
      返回:
      a corresponding BytecodeCompiler instance