类 MethodProxy


  • public class MethodProxy
    extends 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.
    • 方法详细资料

      • getSignature

        public org.springframework.cglib.core.Signature getSignature()
        Return the signature of the proxied method.
      • find

        public static MethodProxy find​(Class type,
                                       org.springframework.cglib.core.Signature sig)
        Return the MethodProxy used when intercepting the method matching the given signature.
        参数:
        type - the class generated by Enhancer
        sig - the signature to match
        返回:
        the MethodProxy instance, or null if no applicable matching method is found
        抛出:
        IllegalArgumentException - if the Class was not created by Enhancer or does not use a MethodInterceptor
      • 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
        抛出:
        Throwable - the bare exceptions thrown by the called method are passed through without wrapping in an InvocationTargetException
        另请参阅:
        MethodInterceptor.intercept(java.lang.Object, java.lang.reflect.Method, java.lang.Object[], org.springframework.cglib.proxy.MethodProxy)
      • 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 MethodInterceptor
        args - the arguments passed to the intercepted method; you may substitute a different argument array as long as the types are compatible
        抛出:
        Throwable - the bare exceptions thrown by the called method are passed through without wrapping in an InvocationTargetException
        另请参阅:
        MethodInterceptor.intercept(java.lang.Object, java.lang.reflect.Method, java.lang.Object[], org.springframework.cglib.proxy.MethodProxy)