Great! I'll experiment with it in a few weeks after a long overdue vacation :-)

----- Original Message -----
From: [email protected]
To: [email protected]
At: Oct  7 2013 11:12:13

@PostConstruct, @DataBoundSetter on fiels, and Descriptor.newInstance() all 
fixed in 1.535.


2013/10/5 domi <[email protected]>

Kohsuke,
while you'r at it, there are more issues around this topic. e.g.
Plugins still using newInstance() are not usable everywhere: 
https://issues.jenkins-ci.org/browse/JENKINS-15445
Even worse, when a plugin provides newInstance() and @DBC: 
https://issues.jenkins-ci.org/browse/JENKINS-18629
/Domi


On 04.10.2013, at 20:15, Kohsuke Kawaguchi <[email protected]> wrote:

> On 10/04/2013 07:00 AM, nicolas de loof wrote:
>> maybe using @PostConstruct ?
>>
>>
>> 2013/10/4 Kevin Fleming (BLOOMBERG/ 731 LEXIN) <[email protected]
>> <mailto:[email protected]>>
>>
>>     How will the object know that Stapler has completed calling 
>> DataBoundSetters
>>     (that all configuration data has been applied)?
>
> Another great idea. Will implement this.
>
>
>>
>>     ----- Original Message -----
>>     From: [email protected] 
>> <mailto:[email protected]>
>>     To: [email protected] 
>> <mailto:[email protected]>
>>     At: Oct 4 2013 00:38:55
>>
>>         great,
>>
>>         so next step is to be able to directly annotate fields à la 
>> hibernate :)
>>
>>
>>           class Foo {
>>
>>               @DataBound
>>                int a,b,c,d;
>>
>>         }
>>
>>
>>         2013/10/4 Kohsuke Kawaguchi <[email protected] 
>> <mailto:[email protected]>>
>>
>>             Today, many complex plugins suffer from a massive constructor
>>             annotated with @DataBoundConstructor.
>>
>>             This is because the form data-binding requires that all the
>>             parameters passed in through the constructor. See xcode plugin 
>> [1]
>>             for an example of this. The situation was worse with plugins that
>>             are used by other plugins, which needed to preserve 
>> ever-increasing
>>             list of constructors to remain backward compatible.
>>
>>             Starting Jenkins 1.535, this problem is no more. Stapler can not
>>             only look for @DataBoundConstructor, but it'll also perform 
>> setter
>>             injection on methods annotated with @DataBoundSetter.
>>
>>             So whereas you had to write:
>>
>>                  class Foo {
>>                    int a,b,c,d;
>>                    @DataBoundConstructor
>>                    public Foo(int a, int b, int c, int d) {
>>                      this.a = a;
>>                      this.b = b;
>>                      this.c = c;
>>                      this.d = d;
>>                    }
>>                  }
>>
>>             You can now write:
>>
>>                  class Foo {
>>                    int a,b,c,d;
>>                    @DataBoundConstructor
>>                    public Foo(int a, int b) {
>>                      this.a = a;
>>                      this.b = b;
>>                    }
>>                    @DataBoundSetter
>>                    public void setC(int c) { this.c = c; }
>>                    @DataBoundSetter
>>                    public void setD(int d) { this.d = d; }
>>                  }
>>
>>             Or even:
>>
>>                  class Foo {
>>                    int a,b,c,d;
>>                    @DataBoundConstructor
>>                    public Foo() {}
>>
>>                    @DataBoundSetter
>>                    public void setA(int a) { this.a = a; }
>>                    @DataBoundSetter
>>                    public void setC(int b) { this.b = b; }
>>                    @DataBoundSetter
>>                    public void setC(int c) { this.c = c; }
>>                    @DataBoundSetter
>>                    public void setD(int d) { this.d = d; }
>>                  }
>>
>>             This will make it easier to evolve plugins that have a large 
>> number
>>             of configuration options.
>>
>>
>>             [1]
>>             
>> https://github.com/jenkinsci/xcode-plugin/blob/master/src/main/java/au/com/rayh/XCodeBuilder.java#L165
 >>
>>
>>             --
>>             Kohsuke Kawaguchi
>>             --
>>             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]
>>             <mailto:jenkinsci-dev%[email protected]>.
>>             For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>         --
>>         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]
>>         <mailto:jenkinsci-dev%[email protected]>.
>>         For more options, visit https://groups.google.com/groups/opt_out.
>>
>>     --
>>     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]
>>     <mailto:jenkinsci-dev%[email protected]>.
>>     For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>> --
>> 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].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
> --
> Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/
> Try Jenkins Enterprise, our professional version of Jenkins
>
> --
> 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].
> For more options, visit https://groups.google.com/groups/opt_out.

--
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].
For more options, visit https://groups.google.com/groups/opt_out.


-- 
Kohsuke Kawaguchi -- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to