Skip to content

Commit 19a6013

Browse files
committed
OpRequest: allow null args
It is important to be able to differentiate null args (not selected yet, e.g. OpEnvironment.op()) from empty args (OpEnvironment.op().output()) of a nullary Op.
1 parent 566ccb0 commit 19a6013

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

scijava-ops-api/src/main/java/org/scijava/ops/api/OpRequest.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -135,31 +135,23 @@ class PartialOpRequest implements OpRequest {
135135
private final Type outType;
136136

137137
PartialOpRequest() {
138-
this.name = null;
139-
this.args = null;
140-
this.outType = null;
138+
this(null);
141139
}
142140

143141
PartialOpRequest(String name) {
144-
this.name = name;
145-
this.args = null;
146-
this.outType = null;
142+
this(name, null);
147143
}
148144

149145
PartialOpRequest(String name, Nil<?>[] args) {
150-
this.name = name;
151-
this.args = Arrays.stream(args) //
152-
.map(nil -> nil == null ? null : nil.getType()) //
153-
.toArray(Type[]::new);
154-
this.outType = null;
146+
this(name, args, null);
155147
}
156148

157149
PartialOpRequest(String name, Nil<?>[] args, Nil<?> outType) {
158150
this.name = name;
159-
this.args = Arrays.stream(args) //
151+
this.args = args == null ? null : Arrays.stream(args) //
160152
.map(nil -> nil == null ? null : nil.getType()) //
161153
.toArray(Type[]::new);
162-
this.outType = outType.getType();
154+
this.outType = outType == null ? null : outType.getType();
163155
}
164156

165157
@Override

0 commit comments

Comments
 (0)