|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eel.kitchen.jsonschema.ref.JsonRef
public final class JsonRef
Representation of a JSON Reference
JSON Reference, currently a draft, is a way to address a JSON instance of whatever type.
To quote the draft, "A JSON Reference is a JSON object, which contains a member named "$ref", which has a JSON string value." This string value must be a URI. Example:
{
"$ref": "http://example.com/example.json#/foo/bar"
}
Here we choose to derive a little from the specification and calculate
references from any field, not just $ref. This class is also used,
for instance, to compute id.
The implementation is a wrapper over Java's URI,
with the following differences:
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
|
static JsonRef |
fromNode(JsonNode node,
String key)
Build a JSON Reference. |
String |
getFragment()
Return this ref's fragment part as a string |
URI |
getLocator()
Return the absolute part of the underlying URI, without the fragment |
boolean |
hasFragment()
|
int |
hashCode()
|
boolean |
isAbsolute()
|
boolean |
isEmpty()
|
JsonRef |
resolve(JsonRef other)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static JsonRef fromNode(JsonNode node,
String key)
throws JsonSchemaException
Note that in the event where there is no member by the requested name, an empty JSON Reference is returned.
node - the JSON instance to extract the reference fromkey - the member to extract the reference from
JsonSchemaException - the key is malformed (not a string,
or not an URI)public boolean isEmpty()
public boolean isAbsolute()
public JsonRef resolve(JsonRef other)
public URI getLocator()
public String getFragment()
If there is no fragment, an empty string is returned.
public boolean hasFragment()
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||