@Test(expected = ConverterException.class) public void testConvertExceptionBySource() { converter.convert("2017-01-01", TypeToken.of(LocalTime.class)); }
@SuppressWarnings("unchecked") @Override public Object convert(Object source, TypeToken<?> targetTypeToken) { if (!canHandle(source, targetTypeToken)) { throw new ConverterException(source, targetTypeToken.getRawType()); } Constructor constructor; try { constructor = ((Class) targetTypeToken.getType()).getConstructor(Object.class); } catch (NoSuchMethodException e) { throw new ConverterException(source, targetTypeToken.getRawType(), e); } try { return constructor.newInstance(source); } catch (Exception e) { throw new ConverterException(source, targetTypeToken.getRawType(), e); } }
DateToJodaTimeBaseLocalConverter extends AbstractConverter { @SuppressWarnings("unchecked") @Override public Object convert(Object source, TypeToken<?> targetTypeToken) { if (!canHandle(source, targetTypeToken)) { throw new ConverterException(source, targetTypeToken.getRawType()); } Constructor constructor; try { constructor = ((Class) targetTypeToken.getType()).getConstructor(Object.class); } catch (NoSuchMethodException e) { throw new ConverterException(source, targetTypeToken.getRawType(), e); } try { return constructor.newInstance(source); } catch (Exception e) { throw new ConverterException(source, targetTypeToken.getRawType(), e); } } }
DateToJodaTimeBaseLocalConverter extends AbstractConverter { @SuppressWarnings("unchecked") @Override public Object convert(Object source, TypeToken<?> targetTypeToken) { if (!canHandle(source, targetTypeToken)) { throw new ConverterException(source, targetTypeToken.getRawType()); } Constructor constructor; try { constructor = ((Class) targetTypeToken.getType()).getConstructor(Object.class); } catch (NoSuchMethodException e) { throw new ConverterException(source, targetTypeToken.getRawType(), e); } try { return constructor.newInstance(source); } catch (Exception e) { throw new ConverterException(source, targetTypeToken.getRawType(), e); } }  }
DateToJodaTimeBaseLocalConverter extends AbstractConverter { @SuppressWarnings("unchecked") @Override public Object convert(Object source, TypeToken<?> targetTypeToken) { if (!canHandle(source, targetTypeToken)) { throw new ConverterException(source, targetTypeToken.getRawType()); } Constructor constructor; try { constructor = ((Class) targetTypeToken.getType()).getConstructor(Object.class); } catch (NoSuchMethodException e) { throw new ConverterException(source, targetTypeToken.getRawType(), e); } try { return constructor.newInstance(source); } catch (Exception e) { throw new ConverterException(source, targetTypeToken.getRawType(), e); } }  @SuppressWarnings("unchecked") @Override Object convert(Object source, TypeToken<?> targetTypeToken); @Override boolean canHandle(Object source, TypeToken<?> targetTypeToken); }
DateToJodaTimeBaseLocalConverter extends AbstractConverter { @SuppressWarnings("unchecked") @Override public Object convert(Object source, TypeToken<?> targetTypeToken) { if (!canHandle(source, targetTypeToken)) { throw new ConverterException(source, targetTypeToken.getRawType()); } Constructor constructor; try { constructor = ((Class) targetTypeToken.getType()).getConstructor(Object.class); } catch (NoSuchMethodException e) { throw new ConverterException(source, targetTypeToken.getRawType(), e); } try { return constructor.newInstance(source); } catch (Exception e) { throw new ConverterException(source, targetTypeToken.getRawType(), e); } }  @SuppressWarnings("unchecked") @Override Object convert(Object source, TypeToken<?> targetTypeToken); @Override boolean canHandle(Object source, TypeToken<?> targetTypeToken);  }