Package org.everit.json.schema
Class ReferenceSchema
java.lang.Object
org.everit.json.schema.Schema
org.everit.json.schema.ReferenceSchema
This class is used by
SchemaLoader to resolve JSON pointers
during the construction of the schema. This class has been made mutable to permit the loading of
recursive schemas.-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ReferenceSchema.Builderbuilder()protected booleanSince we add state in subclasses, but want those subclasses to be non final, this allows us to have equals methods that satisfy the equals contract.booleandefinesProperty(String field) Determines if thisSchemainstance defines any restrictions for the object property denoted byfield.booleangetTitle()Returns the properties of the original schema JSON which aren't keywords of json schema (therefore they weren't recognized during schema loading).inthashCode()voidsetReferredSchema(Schema referredSchema) Called bySchemaLoader.load()to set the referred root schema after completing the loading process of the entire schema document.Methods inherited from class org.everit.json.schema.Schema
describeTo, failure, failure, getDefaultValue, getId, getSchemaLocation, hasDefaultValue, isNullable, isReadOnly, isWriteOnly, toString, validate
-
Constructor Details
-
ReferenceSchema
-
-
Method Details
-
builder
-
definesProperty
Description copied from class:SchemaDetermines if thisSchemainstance defines any restrictions for the object property denoted byfield. Thefieldshould be a JSON pointer, denoting the property to be queried.For example the field
"#/rectangle/a"is defined by the following schema:
You can also check if a subschema of an array defines a property. In that case, to traverse the array, you can either use an integer array index, or theobjectWithSchemaRectangleDep" : { "type" : "object", "dependencies" : { "d" : { "type" : "object", "properties" : { "rectangle" : { "$ref" : "#/definitions/Rectangle" }, "list": { "type": "array", "items": { "properties": { "prop": {} } }, "minItems": 2, "maxItems: 3 } } } }, "definitions" : { "size" : { "type" : "number", "minimum" : 0 }, "Rectangle" : { "type" : "object", "properties" : { "a" : {"$ref" : "#/definitions/size"}, "b" : {"$ref" : "#/definitions/size"} } } } }"all"or"any"meta-indexes. For example, in the above schemadefinesProperty("#/list/any/prop")returnstruedefinesProperty("#/list/all/prop")returnstruedefinesProperty("#/list/1/prop")returnstruedefinesProperty("#/list/1/nonexistent")returnsfalse(the property is not present in the subschema)definesProperty("#/list/8/prop")returnsfalse(the"list"does not define property8, since"maxItems"is3)
- Overrides:
definesPropertyin classSchema- Parameters:
field- should be a JSON pointer in its string representation.- Returns:
trueif the propertty denoted byfieldis defined by this schema instance
-
getReferredSchema
-
getReferenceValue
-
setReferredSchema
Called bySchemaLoader.load()to set the referred root schema after completing the loading process of the entire schema document.- Parameters:
referredSchema- the referred schema
-
equals
-
hashCode
public int hashCode() -
canEqual
Description copied from class:SchemaSince we add state in subclasses, but want those subclasses to be non final, this allows us to have equals methods that satisfy the equals contract.http://www.artima.com/lejava/articles/equality.html
-
getUnprocessedProperties
Description copied from class:SchemaReturns the properties of the original schema JSON which aren't keywords of json schema (therefore they weren't recognized during schema loading).- Overrides:
getUnprocessedPropertiesin classSchema
-
getTitle
-
getDescription
- Overrides:
getDescriptionin classSchema
-
getLocation
- Overrides:
getLocationin classSchema
-