org.jutil.event
Class  TypeApplicabilityNotifier
java.lang.Object
  |
  +--org.jutil.event.TypeApplicabilityNotifier
- All Implemented Interfaces: 
- ApplicabilityNotifier, EventTypeReliancy, ListenerTypeReliancy, ListenerValidity, Notifier
- public abstract class TypeApplicabilityNotifier- extends java.lang.Object- implements ApplicabilityNotifier, ListenerTypeReliancy, EventTypeReliancy
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.
| Specifications inherited from interface ListenerTypeReliancy | 
| public invariant listenerType != null; public invariant Class.forName("java.util.EventListener").isAssignableFrom(listenerType);
 | 
| Specifications inherited from interface EventTypeReliancy | 
| public invariant eventType != null; public invariant Class.forName("java.util.EventObject").isAssignableFrom(eventType);
 | 
 
 
 
 
| Method Summary | 
|  java.lang.Class | getEventType()
 | 
|  java.lang.Class | getListenerType()
 | 
|  boolean | isApplicable(java.util.EventListener listener,
             java.util.EventObject event)If a listener or event is valid, then this must return true.
 | 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
 
 
 
 
CVS_REVISION
public static final java.lang.String CVS_REVISION
TypeApplicabilityNotifier
public TypeApplicabilityNotifier(java.lang.Class listenerType,
                                 java.lang.Class eventType)
- 
- Specifications: pure
- 
 public behavior
 requires listenerType != null;
 requires Class.forName("java.util.EventListener").isAssignableFrom(listenerType);
 requires eventType != null;
 requires Class.forName("java.util.EventObject").isAssignableFrom(eventType);
 assignable listenerType, eventType;
 ensures this.listenerType == listenerType;
 ensures this.eventType == eventType;
 
 
TypeApplicabilityNotifier
public TypeApplicabilityNotifier(java.lang.Class listenerType)
- 
- Specifications: pure
- 
 public behavior
 requires listenerType != null;
 requires Class.forName("java.util.EventListener").isAssignableFrom(listenerType);
 assignable listenerType, eventType;
 ensures this.listenerType == listenerType;
 ensures this.eventType == Class.forName("java.util.EventObject");
 
 
isApplicable
public boolean isApplicable(java.util.EventListener listener,
                            java.util.EventObject event)
- Description copied from interface: ApplicabilityNotifier
- If a listener or event is valid, then this must return true.
   The implication in the formal specification means that the
   model methods can be stronger than the implementation of this
   method. This method only needs to test things which cannot be
   proven. 
- 
- Specifications: pure
-      also
- 
 public behavior
 requires listener != null;
 ensures \result  ==> (listenerType.isInstance(listener)&&((event == null)||eventType.isInstance(event)));
 
 
- Specifications inherited from overridden method in interface ApplicabilityNotifier:
- 
 public behavior
 requires listener != null;
 ensures \result  <== isValidListener(listener)&&isValidEvent(event);
 
 
getListenerType
public final java.lang.Class getListenerType()
- 
- Specifications: pure
- 
 public behavior
 ensures \result  == listenerType;
 
 
getEventType
public final java.lang.Class getEventType()
- 
- Specifications: pure
- 
 public behavior
 ensures \result  == eventType;