/** * Build a {@link JsonSchema} instance * * @param schema the schema * @param pointer the pointer into the schema * @return a new {@link JsonSchema} * @throws ProcessingException resolving the pointer against the schema * leads to a {@link MissingNode} * @throws NullPointerException the schema or pointer is null */ JsonSchema buildJsonSchema(final JsonNode schema, final JsonPointer pointer) throws ProcessingException { final SchemaTree tree = loader.load(schema).setPointer(pointer); if (tree.getNode().isMissingNode()) throw new JsonReferenceException(new ProcessingMessage() .setMessage(BUNDLE.getMessage("danglingRef"))); return new JsonSchemaImpl(processor, tree, reportProvider); }
/** * Build a {@link JsonSchema} instance * * @param uri the URI to load the schema from * @return a {@link JsonSchema} * @throws ProcessingException invalid URI, or URI did not resolve to a * JSON Schema * @throws NullPointerException URI is null */ JsonSchema buildJsonSchema(final String uri) throws ProcessingException { final JsonRef ref = JsonRef.fromString(uri); if (!ref.isLegal()) throw new JsonReferenceException(new ProcessingMessage() .setMessage(BUNDLE.getMessage("illegalJsonRef"))); final SchemaTree tree = loader.get(ref.getLocator()).setPointer(ref.getPointer()); if (tree.getNode().isMissingNode()) throw new JsonReferenceException(new ProcessingMessage() .setMessage(BUNDLE.getMessage("danglingRef"))); return new JsonSchemaImpl(processor, tree, reportProvider); }
/** * Build a JSON Reference from a string input * * @param s the string * @return the reference * @throws JsonReferenceException string is not a valid URI * @throws NullPointerException provided string is null */ public static JsonRef fromString(final String s) throws JsonReferenceException { BUNDLE.checkNotNull(s, "jsonRef.nullInput"); try { return fromURI(new URI(s)); } catch (URISyntaxException e) { throw new JsonReferenceException(new ProcessingMessage() .setMessage(BUNDLE.getMessage("jsonRef.invalidURI")) .putArgument("input", s), e); } }
/** * Build a JSON Reference from a string input * * @param s the string * @return the reference * @throws JsonReferenceException string is not a valid URI * @throws NullPointerException provided string is null */ public static JsonRef fromString(final String s) throws JsonReferenceException { BUNDLE.checkNotNull(s, "jsonRef.nullInput"); try { return fromURI(new URI(s)); } catch (URISyntaxException e) { throw new JsonReferenceException(new ProcessingMessage() .setMessage(BUNDLE.getMessage("jsonRef.invalidURI")) .putArgument("input", s), e); } }
/** * Build a JSON Reference from a string input * * @param s the string * @return the reference * @throws JsonReferenceException string is not a valid URI * @throws NullPointerException provided string is null */ public static JsonRef fromString(final String s) throws JsonReferenceException { BUNDLE.checkNotNull(s, "jsonRef.nullInput"); try { return fromURI(new URI(s)); } catch (URISyntaxException e) { throw new JsonReferenceException(new ProcessingMessage() .setMessage(BUNDLE.getMessage("jsonRef.invalidURI")) .putArgument("input", s), e); } }