@Test public void callToConvertAddsMoreSupportedFormatsToTheContext() throws Exception { ConversionContext context = new ConversionContext.Builder(TypeLiteral.of(OffsetTime.class)).build(); OffsetTimeConverter converter = new OffsetTimeConverter(); converter.convert("", context); assertThat(context.getSupportedFormats().toString()).contains(" (OffsetTimeConverter)"); }
@Override public OffsetTime convert(String value, ConversionContext ctx) { ctx.addSupportedFormats(getClass(), OffsetTime.now().toString()); if(value==null){ return null; } try{ return OffsetTime.parse(value); }catch(Exception e){ LOG.log(Level.FINEST, e, () -> "Cannot parse OffsetTime: " + value); return null; } }
OffsetTimeConverter implements PropertyConverter<OffsetTime> { @Override public OffsetTime convert(String value, ConversionContext ctx) { ctx.addSupportedFormats(getClass(), OffsetTime.now().toString()); if(value==null){ return null; } try{ return OffsetTime.parse(value); }catch(Exception e){ LOG.log(Level.FINEST, e, () -> "Cannot parse OffsetTime: " + value); return null; } } }
OffsetTimeConverter implements PropertyConverter<OffsetTime> { @Override public OffsetTime convert(String value, ConversionContext ctx) { ctx.addSupportedFormats(getClass(), OffsetTime.now().toString()); if(value==null){ return null; } try{ return OffsetTime.parse(value); }catch(Exception e){ LOG.log(Level.FINEST, e, () -> "Cannot parse OffsetTime: " + value); return null; } }  }
OffsetTimeConverter implements PropertyConverter<OffsetTime> { @Override public OffsetTime convert(String value, ConversionContext ctx) { ctx.addSupportedFormats(getClass(), OffsetTime.now().toString()); if(value==null){ return null; } try{ return OffsetTime.parse(value); }catch(Exception e){ LOG.log(Level.FINEST, e, () -> "Cannot parse OffsetTime: " + value); return null; } }  @Override OffsetTime convert(String value, ConversionContext ctx); @Override boolean equals(Object o); @Override int hashCode(); }
OffsetTimeConverter implements PropertyConverter<OffsetTime> { @Override public OffsetTime convert(String value, ConversionContext ctx) { ctx.addSupportedFormats(getClass(), OffsetTime.now().toString()); if(value==null){ return null; } try{ return OffsetTime.parse(value); }catch(Exception e){ LOG.log(Level.FINEST, e, () -> "Cannot parse OffsetTime: " + value); return null; } }  @Override OffsetTime convert(String value, ConversionContext ctx); @Override boolean equals(Object o); @Override int hashCode();  }