« Return to Thread: Categories and keyword arguments

Re: Categories and keyword arguments

by Guillaume Laforge-2 :: Rate this Message:

Reply to Author | View in Thread

Hi,

By "keyword arguments", you mean named parameters?
If so, yes, a category method just has to have a Map as additional
parameter (self, plus that map).
So something like this:

class MyCategory {
    static void myMethod(SomeType self, Map m) { ... }
}

use (MyCategory) {
    new SomeType().myMethod a: 1, b: 2, c: 3
}

Guillaume

On Fri, Jun 26, 2009 at 07:10, John Ky<newhoggy@...> wrote:

> Hi,
>
> Is there a way to define a category method that takes keyword arguments?
> Would the self object or the map object come first in this case?
>
> Thanks,
>
> -John
>
>



--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Categories and keyword arguments