Package org.everit.json.schema
Class ReferenceSchema
- java.lang.Object
-
- org.everit.json.schema.Schema
-
- org.everit.json.schema.ReferenceSchema
-
public class ReferenceSchema extends Schema
This class is used bySchemaLoaderto 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 Modifier and Type Class Description static classReferenceSchema.BuilderBuilder class forReferenceSchema.
-
Constructor Summary
Constructors Constructor Description ReferenceSchema(ReferenceSchema.Builder builder)
-
Method Summary
Modifier and Type Method Description static ReferenceSchema.Builderbuilder()protected booleancanEqual(java.lang.Object other)Since 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(java.lang.String field)Determines if thisSchemainstance defines any restrictions for the object property denoted byfield.booleanequals(java.lang.Object o)java.lang.StringgetDescription()SchemaLocationgetLocation()SchemagetReferredSchema()java.lang.StringgetTitle()java.util.Map<java.lang.String,java.lang.Object>getUnprocessedProperties()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 Detail
-
ReferenceSchema
public ReferenceSchema(ReferenceSchema.Builder builder)
-
-
Method Detail
-
builder
public static ReferenceSchema.Builder builder()
-
definesProperty
public boolean definesProperty(java.lang.String field)
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:
The default implementation of this method always returns false.objectWithSchemaRectangleDep" : { "type" : "object", "dependencies" : { "d" : { "type" : "object", "properties" : { "rectangle" : {"$ref" : "#/definitions/Rectangle" } } } }, "definitions" : { "size" : { "type" : "number", "minimum" : 0 }, "Rectangle" : { "type" : "object", "properties" : { "a" : {"$ref" : "#/definitions/size"}, "b" : {"$ref" : "#/definitions/size"} } } } }- 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
public Schema getReferredSchema()
-
setReferredSchema
public void setReferredSchema(Schema referredSchema)
Called bySchemaLoader.load()to set the referred root schema after completing the loading process of the entire schema document.- Parameters:
referredSchema- the referred schema
-
canEqual
protected boolean canEqual(java.lang.Object other)
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
public java.util.Map<java.lang.String,java.lang.Object> 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
-
getDescription
public java.lang.String getDescription()
- Overrides:
getDescriptionin classSchema
-
getLocation
public SchemaLocation getLocation()
- Overrides:
getLocationin classSchema
-
-