org.eel.kitchen.jsonschema.ref
Class JsonReference

java.lang.Object
  extended by org.eel.kitchen.jsonschema.ref.JsonReference

public final class JsonReference
extends Object

JSON Reference resolution

This class has only one purpose, but a very important one: resolve references to what they eventually point to. It also detects reference loops.

Note that there is no guarantee that the resolved JSON instance is a JSON schema at all, or even an object for that matter.


Constructor Summary
JsonReference()
           
 
Method Summary
static JsonNode resolveRef(JsonNode schema, JsonNode node)
          Resolve a reference relatively to a schema
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonReference

public JsonReference()
Method Detail

resolveRef

public static JsonNode resolveRef(JsonNode schema,
                                  JsonNode node)
                           throws JsonSchemaException,
                                  IOException
Resolve a reference relatively to a schema

This method is the core operating routine of this class, and the only public member. It will resolve references recursively, record schemas along its way and return the result. It will also detect a loop.

Parameters:
schema - the schema
node - the node
Returns:
the JSON instance
Throws:
JsonSchemaException - reference loop detected, or malformed ref
IOException - downloading of a reference failed


Copyright © 2012. All Rights Reserved.