Note that if there is any compiled code (e.g. other plugins) using your
class, that constructor change will break.

I would recommend keeping the old constructor signature (as @Deprecated and
not @DataBoundConstructor); it can just forward to the new constructor and
call the setter.

(I also wonder why you had the old field as Boolean but then do not handle
null.)

On Fri, 5 Jun 2020 at 15:29, John Westcott IV <[email protected]> wrote:

> Thanks for your responses Gavin Mogan and slide.
>
> When I tried to remove the parameter from the @DataBoundConstructor and
> added a second @DataBoundSetter like:
>
>     @DataBoundSetter
>     public void setImportTowerLogs(Boolean importTowerLogs) { 
> this.importTowerLogs = importTowerLogs.toString(); }
>     @DataBoundSetter
>     public void setTImportTowerLogs(String importTowerLogs) { 
> this.importTowerLogs = importTowerLogs; }
>
>
> both pipelines worked with the constructor but only the second
> @DataBoundConstructor would be honored.
>
> To solve my problem I removed the parameter from the @DataBoundConstructor
> and then replaced the old Boolean importTowerLogs with String towerLogLevel
> with the exception that I left the @DataBoundConstructor for importTowerLog
> as:
>       @DataBoundSetter
>
>    public void setImportTowerLogs(Boolean importTowerLogs) { 
> this.towerLogLevel = importTowerLogs.toString(); }
>
>
> Things now seem to work fine for both the old boolean parameter like
> importTowerLogs = {true|false} or with a new string parameter like
> towerLogLevel = {'true'|'false'|'vars'|'full'}.
>
> -John
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/d264323c-7a8d-48a4-af50-a526a46633ddo%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/d264323c-7a8d-48a4-af50-a526a46633ddo%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAKMi--BSSHxEg4nin-6XXQF_8E55G%3DU--fbiSCEd4H8aXqRhhA%40mail.gmail.com.

Reply via email to