> On 31.08.2015, at 01:27, Gilad Baruchian <[email protected]> wrote: > > I am new to plugin development in jenkins and I am currently looking at the > "HelloWorldBuilder" plugin. > the plugin has a inner static final class with "@Extension" annotation that > extends BuildStepDescriptor<Builder>, I don't really understand what is the > purpose of this class, and who is using it.
This is what makes the build step known to Jenkins. I think of Descriptor/Describable similar to class and object —- you can have dozens of the same build step, but they all share the same descriptor (and it’s the descriptor you select in the job configuration dropdown, what you get is the describable), which contains shared configuration and data common to all the instances. > Also I would like to know from where the method "public FormValidation > doCheckName(@QueryParameter String value)" is called to validate the user > input. This magic is provided by the form elements in Jenkins core and how to use it is documented on https://wiki.jenkins-ci.org/display/JENKINS/Form+Validation For more details, see prepareDatabinding.jelly (used by most form elements), which calls Functions.calcCheckUrl(…), which calls Descriptor.getCheckMethod(String), which uses FormValidation.CheckMethod in core. Those use reflection to determine whether a method with the expected name for a given form field exists, and if so, will define 'checkUrl‘ for use in Jelly — and the tag definition (e.g. checkbox.jelly) does the rest, resulting in an attribute added to the HTML tag that indicates it can be validated. If that attribute is set, registerValidator in hudson-behavior.js will cause the URL to be called from the browser, and Stapler’s URL binding[1] does the rest, resulting in an HTTP call to that method. 1: http://stapler.kohsuke.org/reference.html -- 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/1C85731C-42CB-4DCF-A2F2-1535171D0808%40beckweb.net. For more options, visit https://groups.google.com/d/optout.
