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 java.util.Collection;
018    
019    import org.apache.tapestry.IActionListener;
020    
021    /**
022     * @author Howard M. Lewis Ship
023     */
024    public interface ListenerMap
025    {
026    
027        /**
028         * Gets a listener for the given name (which is both a property name and a
029         * method name). The listener is created as needed, but is also cached for
030         * later use. The returned object implements the
031         * {@link org.apache.tapestry.IActionListener}.
032         * 
033         * @param name
034         *            the name of the method to invoke (the most appropriate method
035         *            will be selected if there are multiple overloadings of the
036         *            same method name)
037         * @returns an object implementing {@link IActionListener}.
038         * @throws ApplicationRuntimeException
039         *             if the listener can not be created.
040         */
041        IActionListener getListener(String name);
042    
043        /**
044         * Returns an unmodifiable collection of the names of the listeners
045         * implemented by the target class.
046         * 
047         * @since 1.0.6
048         */
049        Collection getListenerNames();
050    
051        /**
052         * Returns true if this ListenerMapImpl can provide a listener with the
053         * given name.
054         * 
055         * @since 2.2
056         */
057        boolean canProvideListener(String name);
058    }