@Test void getNumberFromRow() { Table table = Table.create( DoubleColumn.create("double", new double[] {1}), FloatColumn.create("float", new float[] {1}), IntColumn.create("integer", new int[] {1}), StringColumn.create("string", new String[] {"1"}), BooleanColumn.create("boolean", new boolean[] {true}), DateColumn.create("date", new LocalDate[] {LocalDate.MIN}) ); Row row = table.row(0); assertEquals(1.0, TableUtils.getNumberFromRow("double", row)); assertEquals(1.0f, TableUtils.getNumberFromRow("float", row)); assertEquals(1, TableUtils.getNumberFromRow("integer", row)); assertEquals(Double.NaN, TableUtils.getNumberFromRow("string", row)); assertEquals(Double.NaN, TableUtils.getNumberFromRow("boolean", row)); assertEquals(Double.NaN, TableUtils.getNumberFromRow("date", row)); }
public static Number getNumberFromRow(String name, Row row) { Object rawValue = row.getObject(name); if (rawValue instanceof Number) { return (Number) rawValue; } return Double.NaN; }
TableUtils { public static Number getNumberFromRow(String name, Row row) { Object rawValue = row.getObject(name); if (rawValue instanceof Number) { return (Number) rawValue; } return Double.NaN; } }
TableUtils { public static Number getNumberFromRow(String name, Row row) { Object rawValue = row.getObject(name); if (rawValue instanceof Number) { return (Number) rawValue; } return Double.NaN; }  }
TableUtils { public static Number getNumberFromRow(String name, Row row) { Object rawValue = row.getObject(name); if (rawValue instanceof Number) { return (Number) rawValue; } return Double.NaN; }  static void createTableOutputColumns(Table table, List<? extends Field> fields); static Number getNumberFromRow(String name, Row row); static boolean isMissing(Row row, Column<?> column); static Optional<NumberColumn> getNumberColumn(String name, Table table); static void allFieldPresentAndCompatible(Table table, List<Field> fields); static Column<?> listToColumn(List<Object> list, Field expectedField); }
TableUtils { public static Number getNumberFromRow(String name, Row row) { Object rawValue = row.getObject(name); if (rawValue instanceof Number) { return (Number) rawValue; } return Double.NaN; }  static void createTableOutputColumns(Table table, List<? extends Field> fields); static Number getNumberFromRow(String name, Row row); static boolean isMissing(Row row, Column<?> column); static Optional<NumberColumn> getNumberColumn(String name, Table table); static void allFieldPresentAndCompatible(Table table, List<Field> fields); static Column<?> listToColumn(List<Object> list, Field expectedField);  }