1
1
package io .jenkins .plugins .echarts ;
2
2
3
+ import edu .hm .hafner .echarts .Build ;
4
+ import edu .hm .hafner .echarts .BuildResult ;
5
+ import edu .umd .cs .findbugs .annotations .NonNull ;
6
+
3
7
import java .util .Iterator ;
4
8
import java .util .NoSuchElementException ;
5
9
import java .util .Optional ;
6
10
import java .util .function .Function ;
7
11
import java .util .function .Predicate ;
8
12
9
- import edu .hm .hafner .echarts .Build ;
10
- import edu .hm .hafner .echarts .BuildResult ;
11
-
12
13
import hudson .model .Run ;
13
14
14
15
import io .jenkins .plugins .util .BuildAction ;
@@ -77,6 +78,23 @@ public static class BuildActionIterable<A extends BuildAction<?>, R> implements
77
78
private final Predicate <A > filter ;
78
79
private final Function <A , R > function ;
79
80
81
+ /**
82
+ * Creates a new instance of {@link BuildActionIterable}.
83
+ *
84
+ * @param actionType
85
+ * the type of the action to select
86
+ * @param latestAction
87
+ * the latest action that will be used as starting point for the sequence of results
88
+ * @param filter
89
+ * filter that selects the action (if there are multiple actions of the same type)
90
+ * @param function
91
+ * the supplier that extracts the specific results from the action
92
+ */
93
+ public BuildActionIterable (final Class <A > actionType , final A latestAction ,
94
+ final Predicate <A > filter , final Function <A , R > function ) {
95
+ this (actionType , Optional .of (latestAction ), filter , function );
96
+ }
97
+
80
98
/**
81
99
* Creates a new instance of {@link BuildActionIterable}.
82
100
*
@@ -97,6 +115,7 @@ public BuildActionIterable(final Class<A> actionType, final Optional<A> latestAc
97
115
this .function = function ;
98
116
}
99
117
118
+ @ NonNull
100
119
@ Override
101
120
public Iterator <BuildResult <R >> iterator () {
102
121
return new GenericBuildActionIterator <>(actionType , latestAction , filter , function );
0 commit comments