1  
     2  /*
     3   * Copyright the original author or authors.
     4   * 
     5   * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
     6   * you may not use this file except in compliance with the License.
     7   * You may obtain a copy of the License at
     8   * 
     9   *      http://www.mozilla.org/MPL/MPL-1.1.html
    10   * 
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17  
    18  import org.as2lib.env.event.EventListenerSource;
    19  
    20  /**
    21   * {@code EventDistributorControl} controls a distributor to distribute events to
    22   * listeners in a compiler-safe manner.
    23   * 
    24   * <p>You can get a distributor via the {@link #getDistributor} method that can be
    25   * casted to your listener type. This enables you to distribute events in a
    26   * compiler-safe manner.
    27   * 
    28   * @author Simon Wacker
    29   * @author Martin Heidegger
    30   */
    31  interface org.as2lib.env.event.distributor.EventDistributorControl extends EventListenerSource {
    32  	
    33  	/**
    34  	 * Returns the typed distributor to distribute the event to all added listeners.
    35  	 * 
    36  	 * <p>The returned distributor can be casted to the type all added listeners have.
    37  	 * You can then invoke the event method on it to distribute it to all added
    38  	 * listeners. This event distribution approach has the advantage of proper
    39  	 * compile-time checking.
    40  	 *
    41  	 * <p>Note that the type of the returned distributor depends on the concrete
    42  	 * implementation of this interface. Most implementations will probably expect the
    43  	 * listener type to be passed-in on construction.
    44  	 * 
    45  	 * @return the distributor to distribute the event
    46  	 */
    47  	public function getDistributor(Void);
    48  	
    49  	/**
    50  	 * Returns the type of listeners this distributor expects. This is also the type of
    51  	 * the distributor returned by the {@link #getDistributor} method.
    52  	 * 
    53  	 * @return the type of the distributor and listeners
    54  	 */
    55  	public function getType(Void):Function;
    56  	
    57  }