groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dogbert <virtualdogb...@gmail.com>
Subject Re: Question about AST Transforms and @DelegatesTo
Date Sun, 25 Sep 2016 13:36:17 GMT
Hi Krzysztof,

That might work, I just have to figure how how to apply that to parameters
in the interface to an AST transform. for example in my case:


@Retention(RetentionPolicy.SOURCE)
@Target([ElementType.TYPE, ElementType.METHOD])
@GroovyASTTransformationClass("com.virtualdogbert.ast.EnforceASTTransformation")
public @interface Enforce {
    Class value()
    Class failure() default {false}
    Class success() default {true}
}


value, failure and success, are closures in the annotation, and those
closures are eventually delegated to a EnforcerService. So after looking at
the documentation this looks promising:
http://www.tothenew.com/blog/gdsl-awesomeness-delegating-closure-calls/

it's just a matter of if it will accept "value()" as the method and Enforce
as the Class. I'll give it a try and see where I get.

Thanks,
Tucker

On Sat, Sep 24, 2016 at 6:38 PM, Krzysztof Kowalczyk <
kowalczyk.krzysztof@gmail.com> wrote:

> Hi Tucker,
>
> If you only want some IDE support, would GDSL be enough for you? Example:
>
> http://www.tothenew.com/blog/gdsl-awesomeness-defining-
> properties-in-a-closure-passed-to-method-of-particular-name/
>
> GDSL can be put in a jar and should be automatically picked up by Idea,
> like
> in
> https://github.com/GPars/GPars/blob/master/src/main/groovy/groovyx/gpars/
> Definitions.gdsl
>
> Regards,
> Krzysztof
>
>
>
> --
> View this message in context: http://groovy.329449.n5.
> nabble.com/Question-about-AST-Transforms-and-DelegatesTo-
> tp5735161p5735605.html
> Sent from the Groovy Users mailing list archive at Nabble.com.
>

Mime
View raw message