public static class ProxyAssembler.ProxyMethod
extends java.lang.Object
java.lang.reflect.Method
in
the ma
array in the containing class.
Pseudo-code for the generated method is:
public ReturnType methodName([ArgumentList]) [throws ExceptionList] { return (ReturnType) [Handler].invoke(this, ma[index], [ArgumentList (as Object[])] or null); }
where:
index
is an index into the enclosing class' array of
delegate Method
objects ma
;
Handler
is the "this" pointer if the proxy itself
is the invocation handler, or the "h" instance field if a separate
invocation handler is stored within the proxy.
For methods which return void
, the return
statement and cast to ReturnType
are omitted. In the event
of an empty argument list, an empty array of type Object
is passed to the InvocationHandler.invoke
method.
Modifier | Constructor and Description |
---|---|
protected |
ProxyMethod()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
assemble(org.objectweb.asm.ClassWriter classWriter,
org.objectweb.asm.MethodVisitor mv,
java.lang.reflect.Method method,
int methodIndex,
boolean parentIsHandler,
java.lang.String proxyName)
Assemble the bytecode which comprises the proxy method.
|
public void assemble(org.objectweb.asm.ClassWriter classWriter, org.objectweb.asm.MethodVisitor mv, java.lang.reflect.Method method, int methodIndex, boolean parentIsHandler, java.lang.String proxyName)
classWriter
- Class writer for proxy class.mv
- Method visitor for this method.method
- Method for which this proxy is being implemented.methodIndex
- Index of this method within the array of methods used by the invocation handler.parentIsHandler
- true
if the parent class implements the
InvocationHandler
interface, else false
. If
true
, no separate instance field will be assembled to store the
invocation handler reference, as the instance of this class itself will act as
the handler.proxyName
- Internal form of the proxy class' name.