@Test(expected = IllegalArgumentException.class) public void testUnsupportedObjectTypeThrowsException() throws IllegalArgumentException { this.schema.convert(new Object()); }
@Override public Object convert(Object value) { if (value instanceof Integer) { return (Integer) value; } else if (value instanceof String) { try { return Integer.parseInt((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException)new IllegalArgumentException(value + " cannot be parsed to an integer").initCause(nfe); } } throw new IllegalArgumentException(value + " is not an integer"); }
IntegerSchema extends PrimitiveNumericSchema<Integer> { @Override public Object convert(Object value) { if (value instanceof Integer) { return (Integer) value; } else if (value instanceof String) { try { return Integer.parseInt((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException)new IllegalArgumentException(value + " cannot be parsed to an integer").initCause(nfe); } } throw new IllegalArgumentException(value + " is not an integer"); } }
IntegerSchema extends PrimitiveNumericSchema<Integer> { @Override public Object convert(Object value) { if (value instanceof Integer) { return (Integer) value; } else if (value instanceof String) { try { return Integer.parseInt((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException)new IllegalArgumentException(value + " cannot be parsed to an integer").initCause(nfe); } } throw new IllegalArgumentException(value + " is not an integer"); } IntegerSchema(); }
IntegerSchema extends PrimitiveNumericSchema<Integer> { @Override public Object convert(Object value) { if (value instanceof Integer) { return (Integer) value; } else if (value instanceof String) { try { return Integer.parseInt((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException)new IllegalArgumentException(value + " cannot be parsed to an integer").initCause(nfe); } } throw new IllegalArgumentException(value + " is not an integer"); } IntegerSchema(); @Override Object convert(Object value); }
IntegerSchema extends PrimitiveNumericSchema<Integer> { @Override public Object convert(Object value) { if (value instanceof Integer) { return (Integer) value; } else if (value instanceof String) { try { return Integer.parseInt((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException)new IllegalArgumentException(value + " cannot be parsed to an integer").initCause(nfe); } } throw new IllegalArgumentException(value + " is not an integer"); } IntegerSchema(); @Override Object convert(Object value);  }