public final class ValidationContext extends Object
This object is passed along the validation process. At any point in the validation process, it contains the current schema context, the feature set and the validator cache.
The latter is necessary since four keywords may have to spawn other
validators: type, disallow, dependencies and
extends.
One instance is created for each validation and is passed around to all validators. Due to this particular usage, it is not thread safe.
| Modifier and Type | Field and Description |
|---|---|
private JsonValidatorCache |
cache |
private SchemaContainer |
container |
private EnumSet<ValidationFeature> |
features |
private Map<String,FormatSpecifier> |
specifiers |
| Constructor and Description |
|---|
ValidationContext(JsonValidatorCache cache) |
ValidationContext(JsonValidatorCache cache,
EnumSet<ValidationFeature> features) |
ValidationContext(JsonValidatorCache cache,
EnumSet<ValidationFeature> features,
FormatBundle bundle) |
ValidationContext(JsonValidatorCache cache,
SchemaContainer container) |
| Modifier and Type | Method and Description |
|---|---|
(package private) SchemaContainer |
getContainer() |
FormatSpecifier |
getFormat(String fmt) |
boolean |
hasFeature(ValidationFeature feature) |
JsonValidator |
newValidator(JsonNode node)
Build a new validator out of a JSON document
|
(package private) void |
setContainer(SchemaContainer container) |
String |
toString() |
private final JsonValidatorCache cache
private SchemaContainer container
private final EnumSet<ValidationFeature> features
private final Map<String,FormatSpecifier> specifiers
public ValidationContext(JsonValidatorCache cache)
public ValidationContext(JsonValidatorCache cache, EnumSet<ValidationFeature> features)
public ValidationContext(JsonValidatorCache cache, EnumSet<ValidationFeature> features, FormatBundle bundle)
public ValidationContext(JsonValidatorCache cache, SchemaContainer container)
SchemaContainer getContainer()
void setContainer(SchemaContainer container)
public boolean hasFeature(ValidationFeature feature)
public FormatSpecifier getFormat(String fmt)
public JsonValidator newValidator(JsonNode node)
This calls JsonValidatorCache.getValidator(SchemaNode) with
this context's SchemaContainer used as a schema context.
node - the node (a subnode of the schema)Copyright © 2012. All Rights Reserved.