提交 ecf7a119 编写于 作者: K Kohsuke Kawaguchi

added a convenience method

上级 c37adad3
......@@ -47,19 +47,29 @@ public class CauseAction implements FoldableAction, RunAction {
private List<Cause> causes = new ArrayList<Cause>();
public CauseAction(Cause c) {
this.causes.add(c);
}
public CauseAction(CauseAction ca) {
this.causes.addAll(ca.causes);
}
@Exported(visibility=2)
public List<Cause> getCauses() {
return causes;
}
/**
* Finds the cause of the specific type.
*/
public <T extends Cause> T findCause(Class<T> type) {
for (Cause c : causes)
if (type.isInstance(c))
return type.cast(c);
return null;
}
public CauseAction(Cause c) {
this.causes.add(c);
}
public CauseAction(CauseAction ca) {
this.causes.addAll(ca.causes);
}
public String getDisplayName() {
return "Cause";
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册