1 /* 2 * Javassist, a Java-bytecode translator toolkit. 3 * Copyright (C) 1999-2007 Shigeru Chiba. All Rights Reserved. 4 * 5 * The contents of this file are subject to the Mozilla Public License Version 6 * 1.1 (the "License"); you may not use this file except in compliance with 7 * the License. Alternatively, the contents of this file may be used under 8 * the terms of the GNU Lesser General Public License Version 2.1 or later. 9 * 10 * Software distributed under the License is distributed on an "AS IS" basis, 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 12 * for the specific language governing rights and limitations under the 13 * License. 14 */ 15 16 package javassist.util.proxy; 17 18 import java.lang.reflect.Method; 19 20 /** 21 * The interface implemented by the invocation handler of a proxy 22 * instance. 23 * 24 * @see ProxyFactory#setHandler(MethodHandler) 25 */ 26 public interface MethodHandler { 27 /** 28 * Is called when a method is invoked on a proxy instance associated 29 * with this handler. This method must process that method invocation. 30 * 31 * @param self the proxy instance. 32 * @param thisMethod the overridden method declared in the super 33 * class or interface. 34 * @param proceed the forwarder method for invoking the overridden 35 * method. It is null if the overridden mehtod is 36 * abstract or declared in the interface. 37 * @param args an array of objects containing the values of 38 * the arguments passed in the method invocation 39 * on the proxy instance. If a parameter type is 40 * a primitive type, the type of the array element 41 * is a wrapper class. 42 * @return the resulting value of the method invocation. 43 * 44 * @throws Throwable if the method invocation fails. 45 */ invoke(Object self, Method thisMethod, Method proceed, Object[] args)46 Object invoke(Object self, Method thisMethod, Method proceed, 47 Object[] args) throws Throwable; 48 } 49