use of org.knime.base.node.jsnippet.util.field.OutVar in project knime-core by knime.
the class OutFieldsTable method getOutVarFields.
/**
* Get the field definitions representing output flow variables.
*
* @return fields representing output flow variables
*/
public OutVarList getOutVarFields() {
OutVarList outVars = new OutVarList();
for (int r = 0; r < m_model.getRowCount(); r++) {
if (!m_model.validateValues(r)) {
// there are errors in this row
continue;
}
Object fieldTypeValue = getFieldType(r);
if (null == fieldTypeValue) {
continue;
}
boolean isFlowVar = fieldTypeValue.equals(FieldType.FlowVariable);
if (isFlowVar) {
OutVar outVar = new OutVar();
outVar.setReplaceExisting((Boolean) m_model.getValueAt(r, Column.REPLACE_EXISTING));
Object colColValue = m_model.getValueAt(r, Column.COLUMN);
if (colColValue instanceof FlowVariable) {
FlowVariable flowVar = (FlowVariable) colColValue;
outVar.setKnimeName(flowVar.getName());
} else if (colColValue instanceof String) {
outVar.setKnimeName(colColValue.toString());
} else {
continue;
}
Object dataTypeValue = m_model.getValueAt(r, Column.DATA_TYPE);
if (dataTypeValue instanceof Type) {
Type type = (Type) dataTypeValue;
outVar.setFlowVarType(type);
} else {
continue;
}
outVar.setJavaName((String) m_model.getValueAt(r, Column.JAVA_FIELD));
Object javaTypeObject = m_model.getValueAt(r, Column.JAVA_TYPE);
if (javaTypeObject instanceof Class) {
outVar.setJavaType((Class) javaTypeObject);
} else {
continue;
}
outVars.add(outVar);
}
}
return outVars;
}
Aggregations