Package com.networknt.schema
Class SchemaLocation
java.lang.Object
com.networknt.schema.SchemaLocation
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder for buildingSchemaLocation
.static class
The fragment can be a JSON pointer to the document or an anchor. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AbsoluteIri
private static final JsonNodePath
static final SchemaLocation
Represents a relative schema location to the current document.private final JsonNodePath
private static final JsonNodePath
private String
-
Constructor Summary
ConstructorsConstructorDescriptionSchemaLocation
(AbsoluteIri absoluteIri) Constructs a newSchemaLocation
.SchemaLocation
(AbsoluteIri absoluteIri, JsonNodePath fragment) Constructs a newSchemaLocation
. -
Method Summary
Modifier and TypeMethodDescriptionappend
(int index) Appends the index to the fragment.Appends the token to the fragment.static SchemaLocation.Builder
builder()
Returns a builder for buildingSchemaLocation
.boolean
Gets the canonical absolute IRI of the schema object.Gets the fragment.int
hashCode()
static SchemaLocation
Parses a string representing an IRI of the schema location.static String
resolve
(SchemaLocation schemaLocation, String absoluteIriReferenceOrFragment) Resolves against a absolute IRI reference or fragment.Resolves against a absolute IRI reference or fragment.toString()
-
Field Details
-
JSON_POINTER
-
ANCHOR
-
DOCUMENT
Represents a relative schema location to the current document. -
absoluteIri
-
fragment
-
value
-
-
Constructor Details
-
SchemaLocation
Constructs a newSchemaLocation
.- Parameters:
absoluteIri
- canonical absolute IRI of the schema objectfragment
- the fragment
-
SchemaLocation
Constructs a newSchemaLocation
.- Parameters:
absoluteIri
- canonical absolute IRI of the schema object
-
-
Method Details
-
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
Gets the fragment.- Returns:
- the fragment
-
append
Appends the token to the fragment.- Parameters:
token
- the segment- Returns:
- a new schema location with the segment
-
append
Appends the index to the fragment.- Parameters:
index
- the segment- Returns:
- a new schema location with the segment
-
of
Parses a string representing an IRI of the schema location.- Parameters:
iri
- the IRI- Returns:
- the schema location
-
resolve
Resolves against a absolute IRI reference or fragment.- Parameters:
absoluteIriReferenceOrFragment
- to resolve- Returns:
- the resolved schema location
-
resolve
Resolves against a absolute IRI reference or fragment.- Parameters:
schemaLocation
- the parentabsoluteIriReferenceOrFragment
- to resolve- Returns:
- the resolved schema location
-
builder
Returns a builder for buildingSchemaLocation
.- Returns:
- the builder
-
toString
-
hashCode
public int hashCode() -
equals
-