improve requirements doc
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
9225585c77
commit
2dc5e3518c
|
|
@ -50,23 +50,31 @@ to be replaced by :
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
|
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
|
||||||
|
try (BulkChange bc = new BulkChange(this)) {
|
||||||
req.bindJSON(this, json);
|
req.bindJSON(this, json);
|
||||||
save();
|
bc.commit();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataBoundSetter
|
@DataBoundSetter
|
||||||
public void setSmtpHost(String smtpHost) {
|
public void setSmtpHost(String smtpHost) {
|
||||||
this.smtpHost = nullify(smtpHost);
|
this.smtpHost = nullify(smtpHost);
|
||||||
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataBoundSetter
|
@DataBoundSetter
|
||||||
public void setReplyToAddress(String address) {
|
public void setReplyToAddress(String address) {
|
||||||
this.replyToAddress = Util.fixEmpty(address);
|
this.replyToAddress = Util.fixEmpty(address);
|
||||||
|
save();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
note: you might not even need to implement `configure` once [#3669](https://github.com/jenkinsci/jenkins/pull/3669)
|
notes:
|
||||||
|
- you also need matching getters for jelly view to render current value, but you probably already have them declared.
|
||||||
|
- use of BulkChange allows to avoid repeated calls to `save()` to actually persist to disk only once fully
|
||||||
|
configured.
|
||||||
|
- you might not even need to implement `configure` once [#3669](https://github.com/jenkinsci/jenkins/pull/3669)
|
||||||
is merged.
|
is merged.
|
||||||
|
|
||||||
### Rule 2: don't use pseudo-properties for optional
|
### Rule 2: don't use pseudo-properties for optional
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue