groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dinko Srko─Ź <dinko.sr...@gmail.com>
Subject Re: @Delegate and Date
Date Tue, 25 Oct 2016 20:34:52 GMT
On 25 October 2016 at 16:02, VG <vitorgg@gmail.com> wrote:
> Hi there,
>
> why this does not work?
>
> class Example {
>     @Delegate Date when
> }
>
> def x = new Example(when: new Date())
> x.next()  // fails
>
> I checked
> http://docs.groovy-lang.org/latest/html/groovy-jdk/java/util/Date.html and
> the next method is available there? Should not the method next be available
> through @delegate?

`next()` is not really a method on `java.util.Date`, but a Groovy's extension.

`Date`'s methods are all there. E.g.

    x.time // works

Cheers,
Dinko

>
> Thanks, Vitor
>
>
>
>
>
> --
> View this message in context: http://groovy.329449.n5.nabble.com/Delegate-and-Date-tp5736295.html
> Sent from the Groovy Users mailing list archive at Nabble.com.

Mime
View raw message