Skip to content

Commit 624b28f

Browse files
committed
Simplyfy getting output DataType for module output.
Signed-off-by: Squareys <squareys@googlemail.com>
1 parent d2420bc commit 624b28f

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

org.knime.scijava.commands/src/org/knime/scijava/commands/module/DefaultNodeModuleService.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.HashSet;
77
import java.util.List;
88
import java.util.Map;
9+
import java.util.Optional;
910

1011
import org.knime.core.data.DataColumnSpec;
1112
import org.knime.core.data.DataTableSpec;
@@ -123,16 +124,12 @@ public Map<ModuleItem<?>, DataType> getOutputMapping(final ModuleInfo info,
123124
final HashMap<ModuleItem<?>, DataType> outputMapping = new HashMap<>();
124125

125126
for (final ModuleItem<?> item : info.outputs()) {
126-
final Collection<JavaToDataCellConverterFactory<?>> sourceFacs = cs
127-
.getMatchingFactories(item.getType());
128-
for (final JavaToDataCellConverterFactory<?> fac : sourceFacs) {
129-
final String type = ((SettingsModelString) models
130-
.get(item.getName())).getStringValue();
131-
if (fac.getDestinationType().getCellClass().getName()
132-
.equals(type)) {
133-
outputMapping.put(item, fac.getDestinationType());
134-
break;
135-
}
127+
final Optional<DataType> type = cs
128+
.getPreferredDataType(item.getType());
129+
130+
if (type.isPresent()) {
131+
final DataType theType = type.get();
132+
outputMapping.put(item, theType);
136133
}
137134
}
138135

0 commit comments

Comments
 (0)