Class SchemaLocation

java.lang.Object
com.networknt.schema.SchemaLocation

public class SchemaLocation extends Object
The 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.
  • Field Details

    • 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 String value
  • Constructor Details

    • SchemaLocation

      public SchemaLocation(AbsoluteIri absoluteIri, JsonNodePath fragment)
      Constructs a new SchemaLocation.
      Parameters:
      absoluteIri - canonical absolute IRI of the schema object
      fragment - the fragment
    • SchemaLocation

      public SchemaLocation(AbsoluteIri absoluteIri)
      Constructs a new SchemaLocation.
      Parameters:
      absoluteIri - canonical absolute IRI of the schema object
  • Method Details

    • 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(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(String iri)
      Parses a string representing an IRI of the schema location.
      Parameters:
      iri - the IRI
      Returns:
      the schema location
    • resolve

      public SchemaLocation resolve(String absoluteIriReferenceOrFragment)
      Resolves against a absolute IRI reference or fragment.
      Parameters:
      absoluteIriReferenceOrFragment - to resolve
      Returns:
      the resolved schema location
    • resolve

      public static String resolve(SchemaLocation schemaLocation, String absoluteIriReferenceOrFragment)
      Resolves against a absolute IRI reference or fragment.
      Parameters:
      schemaLocation - the parent
      absoluteIriReferenceOrFragment - to resolve
      Returns:
      the resolved schema location
    • builder

      public static SchemaLocation.Builder builder()
      Returns a builder for building SchemaLocation.
      Returns:
      the builder
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object