| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public URI parseValue(Object input) throws CoercingParseValueException { |
| 57 | if (input instanceof URI) { |
| 58 | return (URI) input; |
| 59 | } |
| 60 | |
| 61 | try { |
| 62 | if (input instanceof String) { |
| 63 | return new URI((String) input); |
| 64 | } |
| 65 | |
| 66 | if (input instanceof URL) { |
| 67 | return ((URL) input).toURI(); |
| 68 | } |
| 69 | } catch (URISyntaxException e) { |
| 70 | throw new CoercingParseValueException("Unable to create URI: " + input, e); |
| 71 | } |
| 72 | |
| 73 | throw new CoercingParseValueException("Unable to create URI: " + input); |
| 74 | } |
| 75 | |
| 76 | @Override |
| 77 | public URI parseLiteral(Object input) throws CoercingParseLiteralException { |