org.apache.commons.events.observable
Interface ModificationHandlerFactory


public interface ModificationHandlerFactory

Defines a factory for creating ModificationHandler instances.

If an application wants to register its own event handler classes, it should do so using this class. This must be done during initialization to be fully thread-safe. There are two steps:

  1. A factory must be created that is an implementation of this class
  2. One of the registerFactory methods must be called on ObservableCollection

Since:
Commons Events 1.0
Version:
$Revision: 155443 $ $Date: 2005-02-26 13:19:51 +0000 (Sat, 26 Feb 2005) $
Author:
Stephen Colebourne

Method Summary
 ModificationHandler createHandler(Collection coll, Object listener)
          Creates a handler subclass for the specified listener.
 

Method Detail

createHandler

ModificationHandler createHandler(Collection coll,
                                  Object listener)
Creates a handler subclass for the specified listener.

The implementation will normally check to see if the listener is of a suitable type, and then cast it. null is returned if this factory does not handle the specified type.

The listener is defined in terms of an Object to allow for unusual listeners, such as a Swing model object.

The collection the handler is for is passed in to allow for a different handler to be selected for the same listener type based on the collection.

Parameters:
coll - the collection being decorated
listener - a listener object to create a handler for
Returns:
an instantiated handler with the listener attached, or null if the listener type is unsuited to this factory


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.