[
https://issues.apache.org/jira/browse/GROOVY-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17467725#comment-17467725
]
Eric Milles commented on GROOVY-1762:
-------------------------------------
For any method parameter you can test the type with
{{org.codehaus.groovy.ast.ClassHelper#isSAMType(ClassNode)}}
> Add event introspection to the MetaClass
> ----------------------------------------
>
> Key: GROOVY-1762
> URL: https://issues.apache.org/jira/browse/GROOVY-1762
> Project: Groovy
> Issue Type: Improvement
> Components: groovy-runtime
> Affects Versions: 1.0
> Reporter: Daniel Ferrin
> Priority: Minor
> Fix For: 4.x
>
> Attachments: MetaClassGroovyTest.groovy, MetaEvent.java,
> MetaEvent.java, groovy-1762-diff.txt, groovy-1762-diff.txt
>
>
> 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...
--
This message was sent by Atlassian Jira
(v8.20.1#820001)