Class CodegenProxyCreator

java.lang.Object
com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenProxyCreator

public class CodegenProxyCreator extends Object
Generate a proxy with a specified base class.
  • Field Details

    • className

      private String className
    • superClass

      private org.glassfish.pfl.dynamic.codegen.spi.Type superClass
    • interfaces

      private List<org.glassfish.pfl.dynamic.codegen.spi.Type> interfaces
    • methods

      private List<org.glassfish.pfl.dynamic.codegen.spi.MethodInfo> methods
    • debugProps

      private static final Properties debugProps
    • emptyProps

      private static final Properties emptyProps
    • objectArrayType

      private static final org.glassfish.pfl.dynamic.codegen.spi.Type objectArrayType
  • Constructor Details

    • CodegenProxyCreator

      public CodegenProxyCreator(String className, Class sc, Class[] interfaces, Method[] methods)
  • Method Details

    • create

      @Deprecated public Class<?> create(ProtectionDomain pd, ClassLoader cl, boolean debug, PrintStream ps)
      Construct a generator for a proxy class that implements the given interfaces and extends superClass. superClass must satisfy the following requirements:
      1. It must have an accessible no args constructor
      2. It must have a method satisfying the signature Object invoke( int methodNumber, Object[] args ) throws Throwable
      3. The invoke method described above must be accessible to the generated class (generally either public or protected.

      Each method in methods is implemented by a method that:

      1. Creates an array sized to hold the args
      2. Wraps args of primitive type in the appropriate wrapper.
      3. Copies each arg or wrapper arg into the array.
      4. Calls invoke with a method number corresponding to the index of the method in methods. Note that the invoke implementation must use the same method array to figure out which method has been invoked.
      5. Return the result (if any), extracting values from wrappers as needed to handle a return value of a primitive type.

      Note that the generated methods ignore exceptions. It is assumed that the invoke method may throw any desired exception.

      Parameters:
      pd - the protection domain of the generated class
      cl - the classloader in which to generate the class
      debug - if true, generate debug messages
      ps - a PrintStream to which the debug messages should be written
      Returns:
      Generator for class
    • create

      public Class<?> create(Class<?> anchorClass, boolean debug, PrintStream ps)
      Construct a generator for a proxy class that implements the given interfaces and extends superClass. superClass must satisfy the following requirements:
      1. It must have an accessible no args constructor
      2. It must have a method satisfying the signature Object invoke( int methodNumber, Object[] args ) throws Throwable
      3. The invoke method described above must be accessible to the generated class (generally either public or protected.

      Each method in methods is implemented by a method that:

      1. Creates an array sized to hold the args
      2. Wraps args of primitive type in the appropriate wrapper.
      3. Copies each arg or wrapper arg into the array.
      4. Calls invoke with a method number corresponding to the index of the method in methods. Note that the invoke implementation must use the same method array to figure out which method has been invoked.
      5. Return the result (if any), extracting values from wrappers as needed to handle a return value of a primitive type.

      Note that the generated methods ignore exceptions. It is assumed that the invoke method may throw any desired exception.

      Parameters:
      anchorClass - a class in whose classloader the new class should be generated
      debug - if true, generate debug messages
      ps - a PrintStream to which the debug messages should be written
      Returns:
      Generator for class
      Since:
      4.2.1
    • createMethod

      private static void createMethod(int mnum, org.glassfish.pfl.dynamic.codegen.spi.MethodInfo method)