Coverage Report - org.apache.commons.events.observable.ModificationHandlerFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
ModificationHandlerFactory
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright 2003-2004 The Apache Software Foundation
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.apache.commons.events.observable;
 17  
 
 18  
 import java.util.Collection;
 19  
 
 20  
 /**
 21  
  * Defines a factory for creating ModificationHandler instances.
 22  
  * <p>
 23  
  * If an application wants to register its own event handler classes, it should
 24  
  * do so using this class. This must be done during initialization to be 
 25  
  * fully thread-safe. There are two steps:
 26  
  * <ol>
 27  
  * <li>A factory must be created that is an implementation of this class
 28  
  * <li>One of the <code>registerFactory</code> methods must be called on ObservableCollection
 29  
  * </ol>
 30  
  *
 31  
  * @since Commons Events 1.0
 32  
  * @version $Revision: 155443 $ $Date: 2005-02-26 13:19:51 +0000 (Sat, 26 Feb 2005) $
 33  
  * 
 34  
  * @author Stephen Colebourne
 35  
  */
 36  
 public interface ModificationHandlerFactory {
 37  
     
 38  
     /**
 39  
      * Creates a handler subclass for the specified listener.
 40  
      * <p>
 41  
      * The implementation will normally check to see if the listener
 42  
      * is of a suitable type, and then cast it. <code>null</code> is
 43  
      * returned if this factory does not handle the specified type.
 44  
      * <p>
 45  
      * The listener is defined in terms of an Object to allow for unusual
 46  
      * listeners, such as a Swing model object.
 47  
      * <p>
 48  
      * The collection the handler is for is passed in to allow for a different
 49  
      * handler to be selected for the same listener type based on the collection.
 50  
      * 
 51  
      * @param coll  the collection being decorated
 52  
      * @param listener  a listener object to create a handler for
 53  
      * @return an instantiated handler with the listener attached,
 54  
      *  or null if the listener type is unsuited to this factory
 55  
      */
 56  
     ModificationHandler createHandler(Collection coll, Object listener);
 57  
     
 58  
 }