提交 64523255 编写于 作者: J Jesse Glick

Added Cause.onLoad in case a Cause implementation needs to keep a build field.

上级 521b578a
......@@ -76,6 +76,14 @@ public abstract class Cause {
*/
public void onAddedTo(AbstractBuild build) {}
/**
* Called when a build is loaded from disk.
* Useful in case the cause needs to keep a build reference;
* this ought to be {@code transient}.
* @since 1.540
*/
public void onLoad(@Nonnull AbstractBuild<?,?> build) {}
/**
* Report a line to the listener about this cause.
* @since 1.362
......
......@@ -116,8 +116,13 @@ public class CauseAction implements FoldableAction, RunAction2 {
return causes.get(0).getShortDescription();
}
@Override public void onLoad(Run<?,?> r) {
// noop
@Override public void onLoad(Run<?,?> owner) {
if (owner instanceof AbstractBuild) { // cf. onAttached
AbstractBuild<?,?> b = (AbstractBuild) owner;
for (Cause c : causes) {
c.onLoad(b);
}
}
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册