net.sf.cglib
Class MethodProxy

java.lang.Object
  extended by net.sf.cglib.MethodProxy

public abstract class MethodProxy
extends java.lang.Object

Classes generated by Enhancer pass this object to the registered MethodInterceptors 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.19 2003/05/14 19:26:59 herbyderby Exp $
See Also:
Enhancer, MethodInterceptor

Method Summary
static MethodProxy create(java.lang.reflect.Method method, java.lang.reflect.Method superMethod)
          Create a new MethodProxy.
static MethodProxy create(java.lang.reflect.Method method, java.lang.reflect.Method superMethod, java.lang.ClassLoader loader)
          Create a new MethodProxy.
abstract  java.lang.Object invoke(java.lang.Object obj, java.lang.Object[] args)
          Invoke the original method, on a different object of the same type.
abstract  java.lang.Object invokeSuper(java.lang.Object obj, java.lang.Object[] args)
          Invoke the original (super) method on the specified object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

invokeSuper

public abstract java.lang.Object invokeSuper(java.lang.Object obj,
                                             java.lang.Object[] args)
                                      throws java.lang.Throwable
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 MethodInterceptor
args - the arguments passed to the intercepted method; you may substitute a different argument array as long as the types are compatible
Throws:
java.lang.Throwable
See Also:
MethodInterceptor.intercept(java.lang.Object, java.lang.reflect.Method, java.lang.Object[], net.sf.cglib.MethodProxy)

invoke

public abstract java.lang.Object invoke(java.lang.Object obj,
                                        java.lang.Object[] args)
                                 throws java.lang.Throwable
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:
java.lang.Throwable
See Also:
MethodInterceptor.intercept(java.lang.Object, java.lang.reflect.Method, java.lang.Object[], net.sf.cglib.MethodProxy)

create

public static MethodProxy create(java.lang.reflect.Method method,
                                 java.lang.reflect.Method superMethod)
Create a new MethodProxy. Used internally by Enhancer.


create

public static MethodProxy create(java.lang.reflect.Method method,
                                 java.lang.reflect.Method superMethod,
                                 java.lang.ClassLoader loader)
Create a new MethodProxy. Used internally by Enhancer.



Copyright (c) 2001 - Apache Software Foundation