> On 1. Jun 2020, at 2.46, MG <mg...@arscreat.com> wrote:
> 
> @MapConstructor
> 
> On 31/05/2020 20:22, o...@ocs.cz wrote:
>> 
>> 
>>> On 31. 5. 2020, at 6:37 PM, MG <mg...@arscreat.com> wrote:
>>> @NamedVariant 
>> 
>> Thanks, will test the thing, probably it's precisely what I wanted to do.
>> 
>>> On 31/05/2020 12:45, OCsite wrote:
>>>> 
>>>> 
>>>> @Named foo(bar,int bax=666,List baz) {
>>>>   ... whatever ...
>>>> }
>>>> 
>>>> turned to something like
>>>> 
>>>> foo(Map __map=null) {
>>>>   def bar=__map?.bar
>>>>   int bax=__map?.bax==null?666:__map?.bax
>>>>   List baz=__map?.baz
>>>>   ... whatever ...
>>>> }
>>>> 

One thing it doesn't cover, afaik, is default values for the args.  But I don't 
think a simple null check will do: you can't pass "bar: null" to the method, 
then.

There's at least one issue open for this: 
https://issues.apache.org/jira/browse/GROOVY-9532

-mikko

Reply via email to