org.barracudamvc.core.event
Class DefaultListenerFactory

java.lang.Object
  extended byorg.barracudamvc.core.event.DefaultListenerFactory
All Implemented Interfaces:
ListenerFactory
Direct Known Subclasses:
EventConnectorFactory, EventForwardingFactory, EventRedirectFactory, SampleControlHandler, SampleViewHandler

public abstract class DefaultListenerFactory
extends Object
implements ListenerFactory

This class provides the default implementaion for a ListenerFactory Note that a factory is responsible for ensuring threadsafety within the underlying listener, so the factory should either return a new instance of the listener OR keep one static synchronized instance and return that instead.


Field Summary
protected  String id
           
 
Constructor Summary
DefaultListenerFactory()
           
 
Method Summary
protected  String getID(Class cl)
           
abstract  BaseEventListener getInstance()
          Get an instance of the underlying BaseEventListener
abstract  String getListenerID()
          Get the Listener ID associated with this class of listener.
 boolean notifyAlways()
          Return true if you want to always be notified, even when an event has been handled by someone else.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected String id
Constructor Detail

DefaultListenerFactory

public DefaultListenerFactory()
Method Detail

getInstance

public abstract BaseEventListener getInstance()
Get an instance of the underlying BaseEventListener

Specified by:
getInstance in interface ListenerFactory
Returns:
get an instance of the BaseEventListener

notifyAlways

public boolean notifyAlways()
Return true if you want to always be notified, even when an event has been handled by someone else. Return false (default) when you only want to notified if the event hasn't been handled already. Typically, only logging type listeners would return true.

Specified by:
notifyAlways in interface ListenerFactory
Returns:
return true to be notified of the event even if it's already been handled

getListenerID

public abstract String getListenerID()
Get the Listener ID associated with this class of listener. This will generally either be the class name of the listener that the factory creates

Specified by:
getListenerID in interface ListenerFactory
Returns:
the listener ID that describes this factory

getID

protected String getID(Class cl)


Copyright © 2004 BarracudaMVC.org All Rights Reserved.