@Test(expected = DataTypeException.class) public void testParse() throws DataTypeException { DataTypes.DT_DOUBLE.convert("abc"); }
@Override public Double convert(Object source) throws DataTypeException { if (source == null || (source instanceof Double)) { return (Double)source; } else { String stringValue = this.convertToString(source); Double intValue = null; try { if (stringValue.equals("INF")) { stringValue = "Infinity"; } else if (stringValue.equals("-INF")) { stringValue = "-Infinity"; } intValue = Double.parseDouble(stringValue); } catch (NumberFormatException ex) { throw new DataTypeException(this, "Failed to convert from \"" + source.getClass().getCanonicalName() + "\" with value \"" + stringValue + "\" to double", ex); } return intValue; } }
DataTypeDouble extends DataTypeBase<Double> { @Override public Double convert(Object source) throws DataTypeException { if (source == null || (source instanceof Double)) { return (Double)source; } else { String stringValue = this.convertToString(source); Double intValue = null; try { if (stringValue.equals("INF")) { stringValue = "Infinity"; } else if (stringValue.equals("-INF")) { stringValue = "-Infinity"; } intValue = Double.parseDouble(stringValue); } catch (NumberFormatException ex) { throw new DataTypeException(this, "Failed to convert from \"" + source.getClass().getCanonicalName() + "\" with value \"" + stringValue + "\" to double", ex); } return intValue; } } }
DataTypeDouble extends DataTypeBase<Double> { @Override public Double convert(Object source) throws DataTypeException { if (source == null || (source instanceof Double)) { return (Double)source; } else { String stringValue = this.convertToString(source); Double intValue = null; try { if (stringValue.equals("INF")) { stringValue = "Infinity"; } else if (stringValue.equals("-INF")) { stringValue = "-Infinity"; } intValue = Double.parseDouble(stringValue); } catch (NumberFormatException ex) { throw new DataTypeException(this, "Failed to convert from \"" + source.getClass().getCanonicalName() + "\" with value \"" + stringValue + "\" to double", ex); } return intValue; } } private  DataTypeDouble(); }
DataTypeDouble extends DataTypeBase<Double> { @Override public Double convert(Object source) throws DataTypeException { if (source == null || (source instanceof Double)) { return (Double)source; } else { String stringValue = this.convertToString(source); Double intValue = null; try { if (stringValue.equals("INF")) { stringValue = "Infinity"; } else if (stringValue.equals("-INF")) { stringValue = "-Infinity"; } intValue = Double.parseDouble(stringValue); } catch (NumberFormatException ex) { throw new DataTypeException(this, "Failed to convert from \"" + source.getClass().getCanonicalName() + "\" with value \"" + stringValue + "\" to double", ex); } return intValue; } } private  DataTypeDouble(); static DataTypeDouble newInstance(); @Override Double convert(Object source); }
DataTypeDouble extends DataTypeBase<Double> { @Override public Double convert(Object source) throws DataTypeException { if (source == null || (source instanceof Double)) { return (Double)source; } else { String stringValue = this.convertToString(source); Double intValue = null; try { if (stringValue.equals("INF")) { stringValue = "Infinity"; } else if (stringValue.equals("-INF")) { stringValue = "-Infinity"; } intValue = Double.parseDouble(stringValue); } catch (NumberFormatException ex) { throw new DataTypeException(this, "Failed to convert from \"" + source.getClass().getCanonicalName() + "\" with value \"" + stringValue + "\" to double", ex); } return intValue; } } private  DataTypeDouble(); static DataTypeDouble newInstance(); @Override Double convert(Object source);  }