@Test public void convert() throws Exception { OffsetTimeConverter conv = new OffsetTimeConverter(); OffsetTime value = conv.convert("10:15:30+01:00", context); assertThat(OffsetTime.parse("10:15:30+01:00")).isEqualTo(value); value = conv.convert("foo", context); assertThat(value).isNull(); }
@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();  }