Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.0-RC-1
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
It is relatively easy to adapt a closure to a one-method interface. And such conversion should be very useful for implementing functors from within groovy.
syntax can be:
{a->a.name=="a"} as Predicate
The attached class is a dynamic proxy that implements this adapter functionality. It is currently used in a category class to enable a syntax like "Predicate.impl {...}".
Just hook it up to the "as" keyword should make it work.
I applied a modified version of the patch and added a test