@Test(expected = IllegalArgumentException.class) public void testBadConvert() { this.schema.convert("INVALID INPUT"); }
@Override public Object convert(Object value) { if (value instanceof Integer) { return ((Integer) value).doubleValue(); } else if (value instanceof Long) { return ((Long) value).doubleValue(); } else if (value instanceof Float) { return ((Float) value).doubleValue(); } else if (value instanceof Double) { return (Double) value; } else if (value instanceof String) { try { return Double.parseDouble((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException) new IllegalArgumentException(value + " cannot be parsed to a double").initCause(nfe); } } throw new IllegalArgumentException(value + " is not a double"); }
DoubleSchema extends PrimitiveNumericSchema<Double> { @Override public Object convert(Object value) { if (value instanceof Integer) { return ((Integer) value).doubleValue(); } else if (value instanceof Long) { return ((Long) value).doubleValue(); } else if (value instanceof Float) { return ((Float) value).doubleValue(); } else if (value instanceof Double) { return (Double) value; } else if (value instanceof String) { try { return Double.parseDouble((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException) new IllegalArgumentException(value + " cannot be parsed to a double").initCause(nfe); } } throw new IllegalArgumentException(value + " is not a double"); } }
DoubleSchema extends PrimitiveNumericSchema<Double> { @Override public Object convert(Object value) { if (value instanceof Integer) { return ((Integer) value).doubleValue(); } else if (value instanceof Long) { return ((Long) value).doubleValue(); } else if (value instanceof Float) { return ((Float) value).doubleValue(); } else if (value instanceof Double) { return (Double) value; } else if (value instanceof String) { try { return Double.parseDouble((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException) new IllegalArgumentException(value + " cannot be parsed to a double").initCause(nfe); } } throw new IllegalArgumentException(value + " is not a double"); } DoubleSchema(); }
DoubleSchema extends PrimitiveNumericSchema<Double> { @Override public Object convert(Object value) { if (value instanceof Integer) { return ((Integer) value).doubleValue(); } else if (value instanceof Long) { return ((Long) value).doubleValue(); } else if (value instanceof Float) { return ((Float) value).doubleValue(); } else if (value instanceof Double) { return (Double) value; } else if (value instanceof String) { try { return Double.parseDouble((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException) new IllegalArgumentException(value + " cannot be parsed to a double").initCause(nfe); } } throw new IllegalArgumentException(value + " is not a double"); } DoubleSchema(); @Override Object convert(Object value); }
DoubleSchema extends PrimitiveNumericSchema<Double> { @Override public Object convert(Object value) { if (value instanceof Integer) { return ((Integer) value).doubleValue(); } else if (value instanceof Long) { return ((Long) value).doubleValue(); } else if (value instanceof Float) { return ((Float) value).doubleValue(); } else if (value instanceof Double) { return (Double) value; } else if (value instanceof String) { try { return Double.parseDouble((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException) new IllegalArgumentException(value + " cannot be parsed to a double").initCause(nfe); } } throw new IllegalArgumentException(value + " is not a double"); } DoubleSchema(); @Override Object convert(Object value);  }