Class CodeGeneratorUtil


  • public class CodeGeneratorUtil
    extends java.lang.Object
    Class used to get a class directly from code generated by a runtime code generator. The code generator extends this base class, and must implement the getClassData method. Most of this is independent of BCEL, but finalizeMethod is specific to the BCEL framework.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CodeGeneratorUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.Class<?> makeClass​(java.lang.String name, byte[] def, java.lang.Class<?> anchorClass)
      Defines a class in the same classloader as a specified "anchor" class
      static java.lang.Class<?> makeClass​(java.lang.String name, byte[] def, java.security.ProtectionDomain pd, java.lang.ClassLoader loader)
      Deprecated.
      as of Java 11, use #makeClass(String,byte[],Class)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BRIDGE_REF

        private static final Bridge BRIDGE_REF
      • CONSTRUCTOR_METHOD_NAME

        static final java.lang.String CONSTRUCTOR_METHOD_NAME
        See Also:
        Constant Field Values
    • Constructor Detail

      • CodeGeneratorUtil

        private CodeGeneratorUtil()
    • Method Detail

      • makeClass

        @Deprecated
        public static java.lang.Class<?> makeClass​(java.lang.String name,
                                                   byte[] def,
                                                   java.security.ProtectionDomain pd,
                                                   java.lang.ClassLoader loader)
        Deprecated.
        as of Java 11, use #makeClass(String,byte[],Class)
        Defines a class in a classloader.
        Parameters:
        name - the name of the class to define
        def - the byte-code definition of the new class
        pd - the protection domain
        loader - the classloader in which to define the class
        Returns:
        a newly created class in the specified classloader
      • makeClass

        public static java.lang.Class<?> makeClass​(java.lang.String name,
                                                   byte[] def,
                                                   java.lang.Class<?> anchorClass)
        Defines a class in the same classloader as a specified "anchor" class
        Parameters:
        name - the name of the class to define
        def - the byte-code definition of the new class
        anchorClass - an existing class in the desired classloader
        Returns:
        a newly created class