Added a 'required' attribute for @EventSet, indicating event handling required 
by client
----------------------------------------------------------------------------------------

         Key: BEEHIVE-373
         URL: http://issues.apache.org/jira/browse/BEEHIVE-373
     Project: Beehive
        Type: New Feature
  Components: Controls  
    Versions: V1Beta    
    Reporter: Kyle Marvin
    Priority: Minor
     Fix For: TBD


Some Controls expose event sets where a failure to handle the events likely 
indicates that the control is not being used properly.  As an example, imagine 
a TimerControl that exposes the alarm expiring as a Timer event.  Using a 
TimerControl but not declaring a Timer event handler is pretty pointless.  It 
would be great to provide compile-time warnings, for this scenario.  To do so 
would require a new annotation for the EventSet annotation, such as:

     @EventSet(required=true)
     public interface TimerEvent
     {
          public void onTimeout(long time);
     }

The default value of 'required' must be 'false' to ensure backwards-compatible 
behavior.

It may only be possible to do compile-time enforcement for Controls created 
declaratively (using @Control annotation), where the presence of @EventHandler 
annotations can be verified.  It's more problematic to do a similar analysis 
for programmatic controls, without doing some form of code analysis to see if 
event registration methods are called.   A compromise for the latter might be 
do some form of runtime checking.  As an example, it might be considered an 
error to invoke an operation  on the method (but not a property  accessor or 
event reg method) w/out having listeners for all required EventSets.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to