Class CodegenProxyCreator
- java.lang.Object
-
- com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenProxyCreator
-
public class CodegenProxyCreator extends java.lang.Object
Generate a proxy with a specified base class.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
className
private static java.util.Properties
debugProps
private static java.util.Properties
emptyProps
private java.util.List<org.glassfish.pfl.dynamic.codegen.spi.Type>
interfaces
private java.util.List<org.glassfish.pfl.dynamic.codegen.spi.MethodInfo>
methods
private static org.glassfish.pfl.dynamic.codegen.spi.Type
objectArrayType
private org.glassfish.pfl.dynamic.codegen.spi.Type
superClass
-
Constructor Summary
Constructors Constructor Description CodegenProxyCreator(java.lang.String className, java.lang.Class sc, java.lang.Class[] interfaces, java.lang.reflect.Method[] methods)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Class<?>
create(java.lang.Class<?> anchorClass, boolean debug, java.io.PrintStream ps)
Construct a generator for a proxy class that implements the given interfaces and extends superClass.java.lang.Class<?>
create(java.security.ProtectionDomain pd, java.lang.ClassLoader cl, boolean debug, java.io.PrintStream ps)
Deprecated.private static void
createMethod(int mnum, org.glassfish.pfl.dynamic.codegen.spi.MethodInfo method)
-
-
-
Field Detail
-
className
private java.lang.String className
-
superClass
private org.glassfish.pfl.dynamic.codegen.spi.Type superClass
-
interfaces
private java.util.List<org.glassfish.pfl.dynamic.codegen.spi.Type> interfaces
-
methods
private java.util.List<org.glassfish.pfl.dynamic.codegen.spi.MethodInfo> methods
-
debugProps
private static final java.util.Properties debugProps
-
emptyProps
private static final java.util.Properties emptyProps
-
objectArrayType
private static final org.glassfish.pfl.dynamic.codegen.spi.Type objectArrayType
-
-
Method Detail
-
create
@Deprecated public java.lang.Class<?> create(java.security.ProtectionDomain pd, java.lang.ClassLoader cl, boolean debug, java.io.PrintStream ps)
Deprecated.Construct a generator for a proxy class that implements the given interfaces and extends superClass. superClass must satisfy the following requirements:- It must have an accessible no args constructor
- It must have a method satisfying the signature
Object invoke( int methodNumber, Object[] args ) throws Throwable
- 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:
- Creates an array sized to hold the args
- Wraps args of primitive type in the appropriate wrapper.
- Copies each arg or wrapper arg into the array.
- 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.
- 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 classcl
- the classloader in which to generate the classdebug
- if true, generate debug messagesps
- a PrintStream to which the debug messages should be written- Returns:
- Generator for class
-
create
public java.lang.Class<?> create(java.lang.Class<?> anchorClass, boolean debug, java.io.PrintStream ps)
Construct a generator for a proxy class that implements the given interfaces and extends superClass. superClass must satisfy the following requirements:- It must have an accessible no args constructor
- It must have a method satisfying the signature
Object invoke( int methodNumber, Object[] args ) throws Throwable
- 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:
- Creates an array sized to hold the args
- Wraps args of primitive type in the appropriate wrapper.
- Copies each arg or wrapper arg into the array.
- 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.
- 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 generateddebug
- if true, generate debug messagesps
- 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)
-
-