groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shil Sinha <shil.si...@gmail.com>
Subject Re: Object.use as an annotation
Date Thu, 27 Aug 2015 22:19:05 GMT
Hi Rahul,

I actually wrote code to do exactly that a few months ago -
https://github.com/shils/groovy-exp/blob/master/src/main/groovy/internal/transform/UseASTTransformation.groovy.
It most definitely has bugs, and its method selection process isn't very
robust (in comparison to Groovy's actual method selection process), but
feel free to try it out.

On Thu, Aug 27, 2015 at 1:20 AM, Rahul Somasunderam <
rsomasunderam@transcendinsights.com> wrote:

> Hi,
>
> Groovy allows you to create a `Category` class that can be later `use`d. A
> great example is `TimeCategory` that makes dealing with time easy.
>
> Also I see the `@Category` annotation that allows you to mark a class as a
> category. However when it is time to `use` that category, you need to write
>
> use (TimeCategory) {
>   // some code
> }
>
> I was wondering was if there is an annotation I could apply to my method,
> e.g. `@Use(TimeCategory)` to get the same effect.
>
> Is there something in groovy that does that, or any library that already
> does that?
>
> R,
> rahul
>
>
>
> --
> View this message in context:
> http://groovy.329449.n5.nabble.com/Object-use-as-an-annotation-tp5727308.html
> Sent from the Groovy Users mailing list archive at Nabble.com.
>

Mime
View raw message