Package com.networknt.schema
Class SchemaLocation
- java.lang.Object
-
- com.networknt.schema.SchemaLocation
-
public class SchemaLocation extends java.lang.ObjectThe schema location is the canonical IRI of the schema object plus a JSON Pointer fragment indicating the subschema that produced a result. In contrast with the evaluation path, the schema location MUST NOT include by-reference applicators such as $ref or $dynamicRef.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSchemaLocation.BuilderBuilder for buildingSchemaLocation.static classSchemaLocation.FragmentThe fragment can be a JSON pointer to the document or an anchor.
-
Field Summary
Fields Modifier and Type Field Description private AbsoluteIriabsoluteIriprivate static JsonNodePathANCHORstatic SchemaLocationDOCUMENTRepresents a relative schema location to the current document.private JsonNodePathfragmentprivate static JsonNodePathJSON_POINTERprivate java.lang.Stringvalue
-
Constructor Summary
Constructors Constructor Description SchemaLocation(AbsoluteIri absoluteIri)Constructs a newSchemaLocation.SchemaLocation(AbsoluteIri absoluteIri, JsonNodePath fragment)Constructs a newSchemaLocation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SchemaLocationappend(int index)Appends the index to the fragment.SchemaLocationappend(java.lang.String token)Appends the token to the fragment.static SchemaLocation.Builderbuilder()Returns a builder for buildingSchemaLocation.booleanequals(java.lang.Object obj)AbsoluteIrigetAbsoluteIri()Gets the canonical absolute IRI of the schema object.JsonNodePathgetFragment()Gets the fragment.inthashCode()static SchemaLocationof(java.lang.String iri)Parses a string representing an IRI of the schema location.static java.lang.Stringresolve(SchemaLocation schemaLocation, java.lang.String absoluteIriReferenceOrFragment)Resolves against a absolute IRI reference or fragment.SchemaLocationresolve(java.lang.String absoluteIriReferenceOrFragment)Resolves against a absolute IRI reference or fragment.java.lang.StringtoString()
-
-
-
Field Detail
-
JSON_POINTER
private static final JsonNodePath JSON_POINTER
-
ANCHOR
private static final JsonNodePath ANCHOR
-
DOCUMENT
public static final SchemaLocation DOCUMENT
Represents a relative schema location to the current document.
-
absoluteIri
private final AbsoluteIri absoluteIri
-
fragment
private final JsonNodePath fragment
-
value
private volatile java.lang.String value
-
-
Constructor Detail
-
SchemaLocation
public SchemaLocation(AbsoluteIri absoluteIri, JsonNodePath fragment)
Constructs a newSchemaLocation.- Parameters:
absoluteIri- canonical absolute IRI of the schema objectfragment- the fragment
-
SchemaLocation
public SchemaLocation(AbsoluteIri absoluteIri)
Constructs a newSchemaLocation.- Parameters:
absoluteIri- canonical absolute IRI of the schema object
-
-
Method Detail
-
getAbsoluteIri
public AbsoluteIri getAbsoluteIri()
Gets the canonical absolute IRI of the schema object.This is a unique identifier indicated by the $id property or id property in Draft 4 and earlier. This does not have to be network accessible.
- Returns:
- the canonical absolute IRI of the schema object.
-
getFragment
public JsonNodePath getFragment()
Gets the fragment.- Returns:
- the fragment
-
append
public SchemaLocation append(java.lang.String token)
Appends the token to the fragment.- Parameters:
token- the segment- Returns:
- a new schema location with the segment
-
append
public SchemaLocation append(int index)
Appends the index to the fragment.- Parameters:
index- the segment- Returns:
- a new schema location with the segment
-
of
public static SchemaLocation of(java.lang.String iri)
Parses a string representing an IRI of the schema location.- Parameters:
iri- the IRI- Returns:
- the schema location
-
resolve
public SchemaLocation resolve(java.lang.String absoluteIriReferenceOrFragment)
Resolves against a absolute IRI reference or fragment.- Parameters:
absoluteIriReferenceOrFragment- to resolve- Returns:
- the resolved schema location
-
resolve
public static java.lang.String resolve(SchemaLocation schemaLocation, java.lang.String absoluteIriReferenceOrFragment)
Resolves against a absolute IRI reference or fragment.- Parameters:
schemaLocation- the parentabsoluteIriReferenceOrFragment- to resolve- Returns:
- the resolved schema location
-
builder
public static SchemaLocation.Builder builder()
Returns a builder for buildingSchemaLocation.- Returns:
- the builder
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-