001    // Copyright 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry.listener;
016    
017    import org.apache.tapestry.IRequestCycle;
018    
019    /**
020     * An object, used by a {@link org.apache.tapestry.listener.ListenerMap}, to
021     * match requests (possibly with service parameters) to methods (possibly with
022     * arguments). Given a request, a (possibly null or empty) array of service
023     * parameters, and a target object (and its set of public void methods), the
024     * mapping will search for the mostly likely mapping. In order:
025     * <ul>
026     * <li>public void method(params) (where the method takes the same number of
027     * parameters as there are service parameters)
028     * <li>public void method(IRequestCycle, params)
029     * <li>public void method()
030     * <li>public void method(IRequestCycle)
031     * </ul>
032     * 
033     * @author Howard M. Lewis Ship
034     * @since 4.0
035     */
036    public interface ListenerMethodInvoker
037    {
038    
039        /**
040         * Called to invoke the bound listener method.
041         *
042         * @param target The object to call the listener method on.
043         * @param cycle The associated request.
044         */
045        void invokeListenerMethod(Object target, IRequestCycle cycle);
046        
047        /**
048         * The actual method name that this listener represents.
049         *
050         * @return The method name this listener is bound to.
051         */
052        String getMethodName();
053    }