@Test public void testIllegalFormat() throws Exception { translator.setFormat("%zZX"); String floatVal = new String("123"); JdbcResultRow row = new JdbcResultRow(); row.setFieldValue("testField", floatVal, Types.DOUBLE); try { translator.translate(row, 0); fail(); } catch (Exception ex) { } }
@Override public String translate(JdbcResultRow rs, int column) throws SQLException, IOException { Object doubleObject = rs.getFieldValue(column); if(doubleObject instanceof Double) return toString((Double) rs.getFieldValue(column)); else return toString(new Double(rs.getFieldValue(column).toString())); }
DoubleColumnTranslator extends FormattableColumnTranslator { @Override public String translate(JdbcResultRow rs, int column) throws SQLException, IOException { Object doubleObject = rs.getFieldValue(column); if(doubleObject instanceof Double) return toString((Double) rs.getFieldValue(column)); else return toString(new Double(rs.getFieldValue(column).toString())); } }
DoubleColumnTranslator extends FormattableColumnTranslator { @Override public String translate(JdbcResultRow rs, int column) throws SQLException, IOException { Object doubleObject = rs.getFieldValue(column); if(doubleObject instanceof Double) return toString((Double) rs.getFieldValue(column)); else return toString(new Double(rs.getFieldValue(column).toString())); } DoubleColumnTranslator();  DoubleColumnTranslator(String format); }
DoubleColumnTranslator extends FormattableColumnTranslator { @Override public String translate(JdbcResultRow rs, int column) throws SQLException, IOException { Object doubleObject = rs.getFieldValue(column); if(doubleObject instanceof Double) return toString((Double) rs.getFieldValue(column)); else return toString(new Double(rs.getFieldValue(column).toString())); } DoubleColumnTranslator();  DoubleColumnTranslator(String format); @Override String translate(JdbcResultRow rs, int column); @Override String translate(JdbcResultRow rs, String column); }
DoubleColumnTranslator extends FormattableColumnTranslator { @Override public String translate(JdbcResultRow rs, int column) throws SQLException, IOException { Object doubleObject = rs.getFieldValue(column); if(doubleObject instanceof Double) return toString((Double) rs.getFieldValue(column)); else return toString(new Double(rs.getFieldValue(column).toString())); } DoubleColumnTranslator();  DoubleColumnTranslator(String format); @Override String translate(JdbcResultRow rs, int column); @Override String translate(JdbcResultRow rs, String column);  }