public final class ObjectJsonValidator extends Object implements JsonValidator
Unlike what happens with arrays, a same child/value instance of an object may have to satisfy more than one schema. For a given property name, the list of schemas is constructed as follows:
properties,
the corresponding schema is added to the list;patternProperties, if the property name
matches the regex, the corresponding schema is added to the list;additionalProperties is added to the list (an empty schema if
additionalProperties is either true or nonexistent).Its next() method should never be called (it throws an
IllegalStateException if it is).
| Modifier and Type | Field and Description |
|---|---|
private JsonNode |
additionalProperties |
private static JsonNode |
EMPTY_SCHEMA |
private JsonSchemaFactory |
factory |
private Map<String,JsonNode> |
patternProperties |
private Map<String,JsonNode> |
properties |
| Constructor and Description |
|---|
ObjectJsonValidator(JsonSchemaFactory factory,
SchemaNode schemaNode) |
| Modifier and Type | Method and Description |
|---|---|
private Set<JsonNode> |
getSchemas(String key) |
JsonValidator |
next()
Return the next validator in the chain
|
boolean |
validate(ValidationContext context,
ValidationReport report,
JsonNode instance)
Validate the instance, and tell whether validation should continue
|
private void |
validateOne(ValidationContext context,
ValidationReport report,
Map.Entry<String,JsonNode> entry) |
private static final JsonNode EMPTY_SCHEMA
private final JsonSchemaFactory factory
private final JsonNode additionalProperties
ObjectJsonValidator(JsonSchemaFactory factory, SchemaNode schemaNode)
public boolean validate(ValidationContext context, ValidationReport report, JsonNode instance)
JsonValidatorvalidate in interface JsonValidatorcontext - the validation contextreport - the validation reportinstance - the instance to validatepublic JsonValidator next()
JsonValidatorThis will be called iif
JsonValidator.validate(ValidationContext, ValidationReport, JsonNode)
returns true.
next in interface JsonValidatorprivate void validateOne(ValidationContext context, ValidationReport report, Map.Entry<String,JsonNode> entry)
Copyright © 2012. All Rights Reserved.