« Return to Thread: Categories and keyword arguments

Re: Categories and keyword arguments

by John Ky :: Rate this Message:

Reply to Author | View in Thread

It works.  Thanks,

-John

On Fri, Jun 26, 2009 at 3:42 PM, Guillaume Laforge <glaforge@...> wrote:
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