Sir, I find no problem. groovy> def f(boolean b) { println b} groovy> f(b=false) // named groovy> f(b=!false) groovy> boolean bb = 7==70 groovy> f(b=bb) groovy> bb = 7==7 groovy> f(b=bb)
false true false true Perhaps I do not understand the situation. May you kindly post me the failing use-case. T.Rathinavelu Sent from Mail for Windows 10 From: David Karr Lately my only Groovy work is scripted pipelines in Jenkins, version 2.89.4 . I'm working with an api that is somewhat dumb in one respect. The method we call takes ~25 parameters. We send them as named parameters. One of the parameters is of boolean type. What we've discovered from testing is that if we send a value as either "true" or "false", it acts as if we sent "true". If we construct the call without that parameter entirely, it acts as if we sent "false". I tried making it send null, but that just causes it to fail at runtime. We presently have an "if" for that one flag, with two calls to the method, one taking 25 parameters, the other taking 24. It is really obnoxious. Obviously, the proper fix is to change their api so that it works correctly. The reality is, that's not going to happen any time soon in geological terms. Is there a concise groovy syntax we could use that would optionally include or exclude a single parameter to the method? |
- Strategy for optionally excluding a named method parameter? David Karr
- Re: Strategy for optionally excluding a named method par... Peter McNeil
- RE: Strategy for optionally excluding a named method par... Rathinavelu
- RE: Strategy for optionally excluding a named method par... Rathinavelu
- RE: Re: Strategy for optionally excluding a named method... Rathinavelu
- FW: RE: Re: Strategy for optionally excluding a named me... Rathinavelu
- RE: Re: Strategy for optionally excluding a named method... Rathinavelu
- Re: Strategy for optionally excluding a named method par... CFouts
- RE: Re: Strategy for optionally excluding a named method... Rathinavelu
- RE: Re: Re: Strategy for optionally excluding a named me... Rathinavelu