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 class
ObjectSchema.Builder
Builder 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.Builder
builder()
protected boolean
canEqual(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.boolean
definesProperty(String field)
Determines if thisSchema
instance defines any restrictions for the object property denoted byfield
.boolean
equals(Object o)
Integer
getMaxProperties()
Integer
getMinProperties()
Map<Pattern,Schema>
getPatternProperties()
Deprecated.Map<String,Set<String>>
getPropertyDependencies()
Schema
getPropertyNameSchema()
Map<String,Schema>
getPropertySchemas()
List<String>
getRequiredProperties()
Map<String,Schema>
getSchemaDependencies()
Schema
getSchemaOfAdditionalProperties()
int
hashCode()
boolean
permitsAdditionalProperties()
boolean
requiresObject()
-
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 Integer getMaxProperties()
-
getMinProperties
public Integer getMinProperties()
-
getPatternProperties
@Deprecated public Map<Pattern,Schema> getPatternProperties()
Deprecated.
-
getSchemaOfAdditionalProperties
public Schema getSchemaOfAdditionalProperties()
-
getPropertyNameSchema
public Schema getPropertyNameSchema()
-
permitsAdditionalProperties
public boolean permitsAdditionalProperties()
-
requiresObject
public boolean requiresObject()
-
definesProperty
public boolean definesProperty(String field)
Description copied from class:Schema
Determines if thisSchema
instance defines any restrictions for the object property denoted byfield
. Thefield
should be a JSON pointer, denoting the property to be queried.For example the field
"#/rectangle/a"
is defined by the following schema: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:
definesProperty
in classSchema
- Parameters:
field
- should be a JSON pointer in its string representation.- Returns:
true
if the propertty denoted byfield
is defined by this schema instance
-
-