/** * Add a {@code $schema} and matching library to this configuration * * @param uri the value for {@code $schema} * @param library the library * @return this * @throws NullPointerException URI us null or library is null * @throws IllegalArgumentException string is not a URI, or not an absolute * JSON Reference; or a library already exists at this URI. */ public ValidationConfigurationBuilder addLibrary(final String uri, final Library library) { final JsonRef ref; try { ref = JsonRef.fromString(uri); } catch (JsonReferenceException e) { throw new IllegalArgumentException(e.getMessage()); } BUNDLE.checkArgumentPrintf(ref.isAbsolute(), "refProcessing.uriNotAbsolute", ref); BUNDLE.checkNotNull(library, "nullLibrary"); BUNDLE.checkArgumentPrintf(libraries.put(ref, library) == null, "dupLibrary", ref); return this; }
private static URI getLocator(final String input) { final JsonRef ref; try { ref = JsonRef.fromString(input); } catch (JsonReferenceException e) { throw new IllegalArgumentException(e.getMessage()); } BUNDLE.checkArgumentPrintf(ref.isAbsolute(), "jsonRef.notAbsolute", ref); return ref.getLocator(); } }
private static URI getLocator(final String input) { final JsonRef ref; try { ref = JsonRef.fromString(input); } catch (JsonReferenceException e) { throw new IllegalArgumentException(e.getMessage()); } BUNDLE.checkArgumentPrintf(ref.isAbsolute(), "jsonRef.notAbsolute", ref); return ref.getLocator(); } }
private static URI getLocator(final String input) { final JsonRef ref; try { ref = JsonRef.fromString(input); } catch (JsonReferenceException e) { throw new IllegalArgumentException(e.getMessage()); } BUNDLE.checkArgumentPrintf(ref.isAbsolute(), "jsonRef.notAbsolute", ref); return ref.getLocator(); } }