DateToJodaTimeBaseLocalConverter extends AbstractConverter { @Override public boolean canHandle(Object source, TypeToken<?> targetTypeToken) { return targetTypeToken.isSubtypeOf(BaseLocal.class) && (source instanceof Date); }  @SuppressWarnings("unchecked") @Override Object convert(Object source, TypeToken<?> targetTypeToken); @Override boolean canHandle(Object source, TypeToken<?> targetTypeToken);  }
@Test public void canHandle() throws Exception { assertTrue(converter.canHandle(new Date(), TypeToken.of(LocalTime.class))); assertTrue(converter.canHandle(new Date(), TypeToken.of(LocalDate.class))); assertTrue(converter.canHandle(new Date(), TypeToken.of(LocalDateTime.class))); assertFalse(converter.canHandle(new Date(), TypeToken.of(Duration.class))); assertFalse(converter.canHandle("2017-09-03", TypeToken.of(LocalDate.class))); }