@Test void getNumberColumn() { 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}) ); Assertions.assertTrue(TableUtils.getNumberColumn("double", table).isPresent()); Assertions.assertTrue(TableUtils.getNumberColumn("float", table).isPresent()); Assertions.assertTrue(TableUtils.getNumberColumn("integer", table).isPresent()); Assertions.assertTrue(TableUtils.getNumberColumn("string", table).isEmpty()); Assertions.assertTrue(TableUtils.getNumberColumn("boolean", table).isEmpty()); Assertions.assertTrue(TableUtils.getNumberColumn("date", table).isEmpty()); }
public static Optional<NumberColumn> getNumberColumn(String name, Table table) { Column<?> column = table.column(name); if (column instanceof NumberColumn) { return Optional.of((NumberColumn) column); } else { return Optional.empty(); } }
TableUtils { public static Optional<NumberColumn> getNumberColumn(String name, Table table) { Column<?> column = table.column(name); if (column instanceof NumberColumn) { return Optional.of((NumberColumn) column); } else { return Optional.empty(); } } }
TableUtils { public static Optional<NumberColumn> getNumberColumn(String name, Table table) { Column<?> column = table.column(name); if (column instanceof NumberColumn) { return Optional.of((NumberColumn) column); } else { return Optional.empty(); } }  }
TableUtils { public static Optional<NumberColumn> getNumberColumn(String name, Table table) { Column<?> column = table.column(name); if (column instanceof NumberColumn) { return Optional.of((NumberColumn) column); } else { return Optional.empty(); } }  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 Optional<NumberColumn> getNumberColumn(String name, Table table) { Column<?> column = table.column(name); if (column instanceof NumberColumn) { return Optional.of((NumberColumn) column); } else { return Optional.empty(); } }  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);  }