|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jutil.event.TypeApplicabilityNotifier
A support class for optional notifiers that depend on the type of the listener and the event to be processed.
Most often a ChainNotifier
will be used in the case
where the EventSourceSupport
contains listeners of
different types, or when different call-back methods of the
listeners need to be called depending on the type of the event
fired. This class implements the ApplicabilityNotifier.isApplicable(EventListener, EventObject)
method
to check whether the type of the listener and the event is
compatible with a given listener type and event type.
Note that we do not demand this type to be pure (see JML), although all the methods we offer are.
Field Summary | |
static java.lang.String |
CVS_REVISION
|
Constructor Summary | |
TypeApplicabilityNotifier(java.lang.Class listenerType)
public behavior pre listenerType != null; pre Class.forName("java.util.EventListener").isAssignableFrom(listenerType); assignable listenerType, eventType; post this.listenerType == listenerType; post this.eventType == Class.forName("java.util.EventObject"); |
|
TypeApplicabilityNotifier(java.lang.Class listenerType,
java.lang.Class eventType)
public behavior pre listenerType != null; pre Class.forName("java.util.EventListener").isAssignableFrom(listenerType); pre eventType != null; pre Class.forName("java.util.EventObject").isAssignableFrom(eventType); assignable listenerType, eventType; post this.listenerType == listenerType; post this.eventType == eventType; |
Method Summary | |
java.lang.Class |
getEventType()
public behavior post \result == eventType; |
java.lang.Class |
getListenerType()
public behavior post \result == listenerType; |
boolean |
isApplicable(java.util.EventListener listener,
java.util.EventObject event)
also public behavior pre listener != null; post \result ==> (listenerType.isInstance(listener) && ((event == null) || eventType.isInstance(event))); // remember that isInstance would be false when event == null |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jutil.event.Notifier |
notifyEventListener |
Field Detail |
public static final java.lang.String CVS_REVISION
Constructor Detail |
public TypeApplicabilityNotifier(java.lang.Class listenerType, java.lang.Class eventType)
public TypeApplicabilityNotifier(java.lang.Class listenerType)
Method Detail |
public boolean isApplicable(java.util.EventListener listener, java.util.EventObject event)
isApplicable
in interface ApplicabilityNotifier
public final java.lang.Class getListenerType()
public final java.lang.Class getEventType()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |