@@ -49,6 +49,8 @@ public class ExecuteWhen<T> {
49
49
* the {@link ObservableValue} which will be observed by the created {@code Execute...When} instances
50
50
*/
51
51
private ExecuteWhen (ObservableValue <T > observable ) {
52
+ Objects .requireNonNull (observable , "The argument 'observable' must not be null." );
53
+
52
54
this .observable = observable ;
53
55
condition = Optional .empty ();
54
56
}
@@ -79,6 +81,7 @@ public static <T> ExecuteWhen<T> on(ObservableValue<T> observable) {
79
81
*/
80
82
public ExecuteWhen <T > when (Predicate <? super T > condition ) {
81
83
Objects .requireNonNull (condition , "The argument 'condition' must not be null." );
84
+
82
85
this .condition = Optional .of (condition );
83
86
return this ;
84
87
}
@@ -104,6 +107,8 @@ public ExecuteWhen<T> when(Predicate<? super T> condition) {
104
107
* if {@link #when(Predicate)} was not called
105
108
*/
106
109
public ExecuteOnceWhen <T > thenOnce (Consumer <? super T > action ) throws IllegalStateException {
110
+ Objects .requireNonNull (action , "The argument 'action' must not be null." );
111
+
107
112
ensureConditionWasSet ();
108
113
return new ExecuteOnceWhen <T >(observable , condition .get (), action );
109
114
}
@@ -125,6 +130,8 @@ public ExecuteOnceWhen<T> thenOnce(Consumer<? super T> action) throws IllegalSta
125
130
* if {@link #when(Predicate)} was not called
126
131
*/
127
132
public ExecuteAlwaysWhen <T > thenAlways (Consumer <? super T > action ) throws IllegalStateException {
133
+ Objects .requireNonNull (action , "The argument 'action' must not be null." );
134
+
128
135
ensureConditionWasSet ();
129
136
return new ExecuteAlwaysWhen <T >(observable , condition .get (), action );
130
137
}
@@ -139,7 +146,7 @@ private void ensureConditionWasSet() throws IllegalStateException {
139
146
boolean noCondition = !condition .isPresent ();
140
147
if (noCondition )
141
148
throw new IllegalStateException (
142
- "Set a condition with 'when(Predicate<? super T>)' before calling any 'then' method." );
149
+ "Set a condition with 'when(Predicate<? super T>)' before calling any 'then... ' method." );
143
150
}
144
151
145
152
// #end BUILD
0 commit comments