0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

doCheckName on Jenkins plugin

Last updated at Posted at 2013-11-22

Jenkins pluginのコードを見ていてこんなのがあった

public FormValidation doCheckName(@QueryParameter String value) throws IOException, ServletException {
     if (value.length() == 0) { 
        return FormValidation.error("Please set a name");
    }
    if (value.length() < 4) {
        return FormValidation.warning("Isn't the name too short?");
    }
    return FormValidation.ok();
}

これは入力されたフォーム情報にValidationをかける関数だけれど、このdoCheckNameは別に拡張ポイントのオーバライドでもなんでもなくて、field名に合わせて動的にJenkinsが決めてくれるらしい。
つまりconfig.jellyにこんなふうに書いてあると

<f:entry title="Test" field="test">
  <f:textbox />
</f:entry>

このtextboxのvalidationはdoCheckTestが呼ばれることになっている。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?