Class 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 Detail

      • DOCUMENT

        public static final SchemaLocation DOCUMENT
        Represents a relative schema location to the current document.
    • Constructor Detail

      • 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 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​(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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object