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