net.sf.cglib.proxy
Class MethodProxy
java.lang.Object
net.sf.cglib.proxy.MethodProxy
public class MethodProxy
extends java.lang.Object
Classes generated by
Enhancer
pass this object to the
registered
MethodInterceptor
objects when an intercepted method is invoked. It can
be used to either invoke the original method, or call the same method on a different
object of the same type.
$Id: MethodProxy.java,v 1.12 2004/06/24 21:15:20 herbyderby Exp $static MethodProxy | create(ClassLoader loader, Class c1, Class c2, String desc, String name1, String name2) - For internal use by
Enhancer only; see the FastMethod class
for similar functionality.
|
static MethodProxy | find(Class type, Signature sig) - Return the
MethodProxy used when intercepting the method
matching the given signature.
|
Signature | getSignature() - Return the signature of the proxied method.
|
int | getSuperIndex() - Return the
FastClass method index
for the method used by invokeSuper(Object,Object[]) .
|
String | getSuperName() - Return the name of the synthetic method created by CGLIB which is
used by
invokeSuper(Object,Object[]) to invoke the superclass
(non-intercepted) method implementation.
|
Object | invoke(Object obj, Object[] args) - Invoke the original method, on a different object of the same type.
|
Object | invokeSuper(Object obj, Object[] args) - Invoke the original (super) method on the specified object.
|
create
public static MethodProxy create(ClassLoader loader,
Class c1,
Class c2,
String desc,
String name1,
String name2)
find
public static MethodProxy find(Class type,
Signature sig)
Return the MethodProxy
used when intercepting the method
matching the given signature.
type
- the class generated by Enhancersig
- the signature to match
- the MethodProxy instance, or null if no applicable matching method is found
getSignature
public Signature getSignature()
Return the signature of the proxied method.
getSuperIndex
public int getSuperIndex()
Return the
FastClass
method index
for the method used by
invokeSuper(Object,Object[])
. This index uniquely
identifies the method within the generated proxy, and therefore
can be useful to reference external metadata.
getSuperName
public String getSuperName()
Return the name of the synthetic method created by CGLIB which is
used by
invokeSuper(Object,Object[])
to invoke the superclass
(non-intercepted) method implementation. The parameter types are
the same as the proxied method.
invoke
public Object invoke(Object obj,
Object[] args)
throws Throwable
Invoke the original method, on a different object of the same type.
obj
- the compatible object; recursion will result if you use the object passed as the first
argument to the MethodInterceptor (usually not what you want)args
- the arguments passed to the intercepted method; you may substitute a different
argument array as long as the types are compatible
invokeSuper
public Object invokeSuper(Object obj,
Object[] args)
throws Throwable
Invoke the original (super) method on the specified object.
obj
- the enhanced object, must be the object passed as the first
argument to the MethodInterceptorargs
- the arguments passed to the intercepted method; you may substitute a different
argument array as long as the types are compatible
Copyright (c) 2001 - Apache Software Foundation