Class CodegenProxyCreator
java.lang.Object
com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenProxyCreator
Generate a proxy with a specified base class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private static final Properties
private static final Properties
private List
<org.glassfish.pfl.dynamic.codegen.spi.Type> private List
<org.glassfish.pfl.dynamic.codegen.spi.MethodInfo> private static final org.glassfish.pfl.dynamic.codegen.spi.Type
private org.glassfish.pfl.dynamic.codegen.spi.Type
-
Constructor Summary
ConstructorsConstructorDescriptionCodegenProxyCreator
(String className, Class sc, Class[] interfaces, Method[] methods) -
Method Summary
Modifier and TypeMethodDescriptionClass
<?> create
(Class<?> anchorClass, boolean debug, PrintStream ps) Construct a generator for a proxy class that implements the given interfaces and extends superClass.Class
<?> create
(ProtectionDomain pd, ClassLoader cl, boolean debug, PrintStream ps) Deprecated.private static void
createMethod
(int mnum, org.glassfish.pfl.dynamic.codegen.spi.MethodInfo method)
-
Field Details
-
className
-
superClass
private org.glassfish.pfl.dynamic.codegen.spi.Type superClass -
interfaces
-
methods
-
debugProps
-
emptyProps
-
objectArrayType
private static final org.glassfish.pfl.dynamic.codegen.spi.Type objectArrayType
-
-
Constructor Details
-
CodegenProxyCreator
-
-
Method Details
-
create
@Deprecated public Class<?> create(ProtectionDomain pd, ClassLoader cl, boolean debug, 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
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)
-
create(Class, boolean, PrintStream)