Uploaded image for project: 'Beehive'
  1. Beehive
  2. BEEHIVE-893

Change dispatchEvent method signature to use varargs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Controls
    • None
    • N/A

    Description

      I suggest we use varargs in the org.apache.beehive.controls.api.events.EventDispatcher interface. This would make client code that use the method easier to read and easier to contrstuct. The fowllowing is the detail of this suggestion:

      Before:

      public Object dispatchEvent(ControlHandle target, EventRef event, Object [] args)
      throws IllegalAccessException, IllegalArgumentException,
      InvocationTargetException;

      After

      public Object dispatchEvent(ControlHandle target, EventRef event, Object... args)
      throws IllegalAccessException, IllegalArgumentException,
      InvocationTargetException;

      For example, to dispatch a no-arg event, the client code that calls this method would be

      dispatcher.dispatchEvent(target, event);

      Rather than

      dispatcher.dispatchEvent(target, event, new Object[] {});

      Similarily, it looks nicer when you have arguments.

      Thanks

      Attachments

        1. patch-893
          3 kB
          Xibin Zeng

        Activity

          People

            Unassigned Unassigned
            xibin Xibin Zeng
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: