169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal/* 269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * Javassist, a Java-bytecode translator toolkit. 369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * Copyright (C) 1999-2007 Shigeru Chiba. All Rights Reserved. 469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * The contents of this file are subject to the Mozilla Public License Version 669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 1.1 (the "License"); you may not use this file except in compliance with 769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * the License. Alternatively, the contents of this file may be used under 869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * the terms of the GNU Lesser General Public License Version 2.1 or later. 969e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 1069e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * Software distributed under the License is distributed on an "AS IS" basis, 1169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 1269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * for the specific language governing rights and limitations under the 1369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * License. 1469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal */ 1569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal 1669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigalpackage javassist.util.proxy; 1769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal 1869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigalimport java.lang.reflect.Method; 1969e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal 2069e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal/** 2169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * The interface implemented by the invocation handler of a proxy 2269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * instance. 2369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 2469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @see ProxyFactory#setHandler(MethodHandler) 2569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal */ 2669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigalpublic interface MethodHandler { 2769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal /** 2869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * Is called when a method is invoked on a proxy instance associated 2969e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * with this handler. This method must process that method invocation. 3069e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 3169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @param self the proxy instance. 3269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @param thisMethod the overridden method declared in the super 3369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * class or interface. 3469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @param proceed the forwarder method for invoking the overridden 3569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * method. It is null if the overridden mehtod is 3669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * abstract or declared in the interface. 3769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @param args an array of objects containing the values of 3869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * the arguments passed in the method invocation 3969e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * on the proxy instance. If a parameter type is 4069e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * a primitive type, the type of the array element 4169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * is a wrapper class. 4269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @return the resulting value of the method invocation. 4369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 4469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @throws Throwable if the method invocation fails. 4569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal */ 4669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal Object invoke(Object self, Method thisMethod, Method proceed, 4769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal Object[] args) throws Throwable; 4869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal} 49