1 /* 2 * Copyright 2002,2003 The Apache Software Foundation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.mockito.cglib.proxy; 17 18 /** 19 * General-purpose {@link Enhancer} callback which provides for "around advice". 20 * @author Juozas Baliuka <a href="mailto:baliuka@mwm.lt">baliuka@mwm.lt</a> 21 * @version $Id: MethodInterceptor.java,v 1.8 2004/06/24 21:15:20 herbyderby Exp $ 22 */ 23 public interface MethodInterceptor 24 extends Callback 25 { 26 /** 27 * All generated proxied methods call this method instead of the original method. 28 * The original method may either be invoked by normal reflection using the Method object, 29 * or by using the MethodProxy (faster). 30 * @param obj "this", the enhanced object 31 * @param method intercepted Method 32 * @param args argument array; primitive types are wrapped 33 * @param proxy used to invoke super (non-intercepted method); may be called 34 * as many times as needed 35 * @throws Throwable any exception may be thrown; if so, super method will not be invoked 36 * @return any value compatible with the signature of the proxied method. Method returning void will ignore this value. 37 * @see MethodProxy 38 */ intercept(Object obj, java.lang.reflect.Method method, Object[] args, MethodProxy proxy)39 public Object intercept(Object obj, java.lang.reflect.Method method, Object[] args, 40 MethodProxy proxy) throws Throwable; 41 42 } 43