mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
added a convenience method.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@31888 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
4ae0cc7c19
commit
8fe700b910
1 file changed
+12
@@ -395,6 +395,18 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
return Collections.unmodifiableList(a.getCauses());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Cause} of a particular type.
|
||||
*
|
||||
* @since 1.362
|
||||
*/
|
||||
public <T extends Cause> T getCause(Class<T> type) {
|
||||
for (Cause c : getCauses())
|
||||
if (type.isInstance(c))
|
||||
return type.cast(c);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this log file should be kept and not deleted.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user