Package org.everit.json.schema
Class ObjectSchema
- java.lang.Object
-
- org.everit.json.schema.Schema
-
- org.everit.json.schema.ObjectSchema
-
public class ObjectSchema extends Schema
Object schema validator.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classObjectSchema.BuilderBuilder class forObjectSchema.
-
Field Summary
-
Fields inherited from class org.everit.json.schema.Schema
schemaLocation
-
-
Constructor Summary
Constructors Constructor Description ObjectSchema(ObjectSchema.Builder builder)Constructor.
-
Method Summary
Modifier and Type Method Description static ObjectSchema.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.IntegergetMaxProperties()java.lang.IntegergetMinProperties()java.util.Map<java.util.regex.Pattern,Schema>getPatternProperties()Deprecated.java.util.Map<java.lang.String,java.util.Set<java.lang.String>>getPropertyDependencies()SchemagetPropertyNameSchema()java.util.Map<java.lang.String,Schema>getPropertySchemas()java.util.List<java.lang.String>getRequiredProperties()java.util.Map<java.lang.String,Schema>getSchemaDependencies()SchemagetSchemaOfAdditionalProperties()inthashCode()booleanpermitsAdditionalProperties()booleanrequiresObject()-
Methods inherited from class org.everit.json.schema.Schema
describeTo, failure, failure, getDefaultValue, getDescription, getId, getLocation, getSchemaLocation, getTitle, getUnprocessedProperties, hasDefaultValue, isNullable, isReadOnly, isWriteOnly, toString, validate
-
-
-
-
Constructor Detail
-
ObjectSchema
public ObjectSchema(ObjectSchema.Builder builder)
Constructor.- Parameters:
builder- the builder object containing validation criteria
-
-
Method Detail
-
builder
public static ObjectSchema.Builder builder()
-
getMaxProperties
public java.lang.Integer getMaxProperties()
-
getMinProperties
public java.lang.Integer getMinProperties()
-
getPatternProperties
@Deprecated public java.util.Map<java.util.regex.Pattern,Schema> getPatternProperties()
Deprecated.
-
getPropertyDependencies
public java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getPropertyDependencies()
-
getPropertySchemas
public java.util.Map<java.lang.String,Schema> getPropertySchemas()
-
getRequiredProperties
public java.util.List<java.lang.String> getRequiredProperties()
-
getSchemaDependencies
public java.util.Map<java.lang.String,Schema> getSchemaDependencies()
-
getSchemaOfAdditionalProperties
public Schema getSchemaOfAdditionalProperties()
-
getPropertyNameSchema
public Schema getPropertyNameSchema()
-
permitsAdditionalProperties
public boolean permitsAdditionalProperties()
-
requiresObject
public boolean requiresObject()
-
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
-
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
-
-