@Test public void testConvert_NotPresent() throws Exception { URIConverter converter = new URIConverter(); assertThat(converter.convert("", context)).isNull(); assertThat(converter.convert(null, context)).isNull(); }
@Override public URI convert(String value, ConversionContext ctx) { ctx.addSupportedFormats(getClass(), "<uri> -> new URI(uri)"); if(value==null){ return null; } String trimmed = value.trim(); if(value.isEmpty()){ return null; } try { return new URI(trimmed); } catch (Exception e) { LOG.log(Level.FINE, "Unparseable URI: " + trimmed, e); return null; } }
URIConverter implements PropertyConverter<URI> { @Override public URI convert(String value, ConversionContext ctx) { ctx.addSupportedFormats(getClass(), "<uri> -> new URI(uri)"); if(value==null){ return null; } String trimmed = value.trim(); if(value.isEmpty()){ return null; } try { return new URI(trimmed); } catch (Exception e) { LOG.log(Level.FINE, "Unparseable URI: " + trimmed, e); return null; } } }
URIConverter implements PropertyConverter<URI> { @Override public URI convert(String value, ConversionContext ctx) { ctx.addSupportedFormats(getClass(), "<uri> -> new URI(uri)"); if(value==null){ return null; } String trimmed = value.trim(); if(value.isEmpty()){ return null; } try { return new URI(trimmed); } catch (Exception e) { LOG.log(Level.FINE, "Unparseable URI: " + trimmed, e); return null; } }  }
URIConverter implements PropertyConverter<URI> { @Override public URI convert(String value, ConversionContext ctx) { ctx.addSupportedFormats(getClass(), "<uri> -> new URI(uri)"); if(value==null){ return null; } String trimmed = value.trim(); if(value.isEmpty()){ return null; } try { return new URI(trimmed); } catch (Exception e) { LOG.log(Level.FINE, "Unparseable URI: " + trimmed, e); return null; } }  @Override URI convert(String value, ConversionContext ctx); @Override boolean equals(Object o); @Override int hashCode(); }
URIConverter implements PropertyConverter<URI> { @Override public URI convert(String value, ConversionContext ctx) { ctx.addSupportedFormats(getClass(), "<uri> -> new URI(uri)"); if(value==null){ return null; } String trimmed = value.trim(); if(value.isEmpty()){ return null; } try { return new URI(trimmed); } catch (Exception e) { LOG.log(Level.FINE, "Unparseable URI: " + trimmed, e); return null; } }  @Override URI convert(String value, ConversionContext ctx); @Override boolean equals(Object o); @Override int hashCode();  }