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