001    /*
002     * (c) 2003-2005, 2009, 2010 ThoughtWorks Ltd
003     * All rights reserved.
004     *
005     * The software in this package is published under the terms of the BSD
006     * style license a copy of which has been included with this distribution in
007     * the LICENSE.txt file.
008     * 
009     * Created on 03-May-2004
010     */
011    package com.thoughtworks.proxy;
012    
013    import java.io.Serializable;
014    import java.lang.reflect.Method;
015    
016    
017    /**
018     * Generic interface for any call made to a proxy instance. This is the main interface for any proxy implementation
019     * using a {@link ProxyFactory}. An implementation realizes an invocation handler for the proxy. So it has the same
020     * purpose as {@link java.lang.reflect.InvocationHandler}.
021     *
022     * @since 0.1
023     */
024    public interface Invoker extends Serializable {
025        
026        /**
027         * Invocation of a method of the proxied object.
028         *
029         * @param proxy  the proxy instance.
030         * @param method the method to invoke.
031         * @param args   the arguments of the method.
032         * @return the result of the invoked method.
033         * @throws Throwable if the invoked method has thrown.
034         * @since 0.1
035         */
036        Object invoke(Object proxy, Method method, Object[] args) throws Throwable;
037    }