@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).longValue(); } else if (value instanceof Long) { return (Long) value; } else if (value instanceof String) { try { return Long.parseLong((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException) new IllegalArgumentException(value + " cannot be parsed to a long").initCause(nfe); } } throw new IllegalArgumentException(value + " is not a long"); }
LongSchema extends PrimitiveNumericSchema<Long> { @Override public Object convert(Object value) { if (value instanceof Integer) { return ((Integer) value).longValue(); } else if (value instanceof Long) { return (Long) value; } else if (value instanceof String) { try { return Long.parseLong((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException) new IllegalArgumentException(value + " cannot be parsed to a long").initCause(nfe); } } throw new IllegalArgumentException(value + " is not a long"); } }
LongSchema extends PrimitiveNumericSchema<Long> { @Override public Object convert(Object value) { if (value instanceof Integer) { return ((Integer) value).longValue(); } else if (value instanceof Long) { return (Long) value; } else if (value instanceof String) { try { return Long.parseLong((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException) new IllegalArgumentException(value + " cannot be parsed to a long").initCause(nfe); } } throw new IllegalArgumentException(value + " is not a long"); } LongSchema(); }
LongSchema extends PrimitiveNumericSchema<Long> { @Override public Object convert(Object value) { if (value instanceof Integer) { return ((Integer) value).longValue(); } else if (value instanceof Long) { return (Long) value; } else if (value instanceof String) { try { return Long.parseLong((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException) new IllegalArgumentException(value + " cannot be parsed to a long").initCause(nfe); } } throw new IllegalArgumentException(value + " is not a long"); } LongSchema(); @Override Object convert(Object value); }
LongSchema extends PrimitiveNumericSchema<Long> { @Override public Object convert(Object value) { if (value instanceof Integer) { return ((Integer) value).longValue(); } else if (value instanceof Long) { return (Long) value; } else if (value instanceof String) { try { return Long.parseLong((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentException) new IllegalArgumentException(value + " cannot be parsed to a long").initCause(nfe); } } throw new IllegalArgumentException(value + " is not a long"); } LongSchema(); @Override Object convert(Object value);  }