class AnnotatedSubsystem implements Subsystem<M> {

   @Override
   public void onEvent(AddressableEvent event, SubsystemContext<M> context) {
      if(event instanceof MessageReceivedEvent) {
         MessageReceivedEvent mre = (MessageReceivedEvent) event;
         if(mre.getMessage().isRequest()) {
            handleRequest(mre, context);
         }
         else {
            fireMessageReceived(mre, context);
         }
      }
      else if(event instanceof SubsystemResponseEvent) {
         handleResponse((SubsystemResponseEvent) event, context);
      }
      else if(event instanceof ModelAddedEvent) {
         fireModelAdded((ModelAddedEvent) event, context);
      }
      else if(event instanceof ModelChangedEvent) {
         fireModelChanged((ModelChangedEvent) event, context);
      }
      else if(event instanceof ModelReportEvent) {
         fireReport((ModelReportEvent) event, context);
      }
      else if(event instanceof ModelRemovedEvent) {
         fireModelRemoved((ModelRemovedEvent) event, context);
      }
      else if(event instanceof ScheduledEvent) {
         fireScheduledEvent((ScheduledEvent) event, context);
      }
      else if(event instanceof SubsystemActivatedEvent) {
         onActivated(context);
      }
      else if(event instanceof SubsystemAddedEvent) {
         onAdded(context);
      }
      else if(event instanceof SubsystemStartedEvent) {
         onStarted(context);
      }
      else if(event instanceof SubsystemStoppedEvent) {
         onStopped(context);
      }
      else if(event instanceof SubsystemRemovedEvent) {
         onRemoved(context);
      }
      else if(event instanceof SubsystemDeactivatedEvent) {
         onDeactivated(context);
      }
      else {
         context.logger().debug("Unrecognized event {}", event);
      }
   }

   public  AnnotatedSubsystem();

}