Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-1762

Add event introspection to the MetaClass

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.0
    • 4.x
    • groovy-runtime
    • None

    Description

      There is no means to determine which events an object can accept closures for. As an example the snippet <code>button.actionPerformed = { doButtonAction())</code> would require the user to know that one of the listener methods on JButton is an ActionListener with an actionPerfomed method, but there is no programatic way to introspect that pseudo property.

      The soluition would be to extend MetaMethod with the needed fields to provide sensible information about the event, and enumerate that in the MetaClass via a getEvents() method.

      Implementation forthcoming...

      Attachments

        1. groovy-1762-diff.txt
          9 kB
          Daniel Ferrin
        2. groovy-1762-diff.txt
          5 kB
          Daniel Ferrin
        3. MetaClassGroovyTest.groovy
          1 kB
          Daniel Ferrin
        4. MetaEvent.java
          5 kB
          Daniel Ferrin
        5. MetaEvent.java
          6 kB
          Daniel Ferrin

        Activity

          People

            Unassigned Unassigned
            shemnon Daniel Ferrin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: