Package net.sf.cglib.proxy
Class MethodProxy
java.lang.Object
net.sf.cglib.proxy.MethodProxy
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.- Version:
- $Id: MethodProxy.java,v 1.16 2009/01/11 20:09:48 herbyderby Exp $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate MethodProxy.CreateInfo
private MethodProxy.FastClassInfo
private final Object
private Signature
private Signature
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MethodProxy
For internal use byEnhancer
only; see theFastMethod
class for similar functionality.static MethodProxy
Return theMethodProxy
used when intercepting the method matching the given signature.(package private) FastClass
Return the signature of the proxied method.(package private) FastClass
int
Return theFastClass
method index for the method used byinvokeSuper(java.lang.Object, java.lang.Object[])
.Return the name of the synthetic method created by CGLIB which is used byinvokeSuper(java.lang.Object, java.lang.Object[])
to invoke the superclass (non-intercepted) method implementation.private static FastClass
helper
(MethodProxy.CreateInfo ci, Class type) private void
init()
Invoke the original method, on a different object of the same type.invokeSuper
(Object obj, Object[] args) Invoke the original (super) method on the specified object.
-
Field Details
-
sig1
-
sig2
-
createInfo
-
initLock
-
fastClassInfo
-
-
Constructor Details
-
MethodProxy
private MethodProxy()
-
-
Method Details
-
create
For internal use byEnhancer
only; see theFastMethod
class for similar functionality. -
init
private void init() -
helper
-
getSignature
Return the signature of the proxied method. -
getSuperName
Return the name of the synthetic method created by CGLIB which is used byinvokeSuper(java.lang.Object, java.lang.Object[])
to invoke the superclass (non-intercepted) method implementation. The parameter types are the same as the proxied method. -
getSuperIndex
public int getSuperIndex()Return theFastClass
method index for the method used byinvokeSuper(java.lang.Object, java.lang.Object[])
. This index uniquely identifies the method within the generated proxy, and therefore can be useful to reference external metadata.- See Also:
-
getFastClass
FastClass getFastClass() -
getSuperFastClass
FastClass getSuperFastClass() -
find
Return theMethodProxy
used when intercepting the method matching the given signature.- Parameters:
type
- the class generated by Enhancersig
- the signature to match- Returns:
- the MethodProxy instance, or null if no applicable matching method is found
- Throws:
IllegalArgumentException
- if the Class was not created by Enhancer or does not use a MethodInterceptor
-
invoke
Invoke the original method, on a different object of the same type.- Parameters:
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- Throws:
Throwable
- the bare exceptions thrown by the called method are passed through without wrapping in anInvocationTargetException
- See Also:
-
invokeSuper
Invoke the original (super) method on the specified object.- Parameters:
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- Throws:
Throwable
- the bare exceptions thrown by the called method are passed through without wrapping in anInvocationTargetException
- See Also:
-