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.
| Constructor and Description |
|---|
ValidationContext(JsonValidatorCache cache)
Create a validation context with an empty feature set
|
ValidationContext(JsonValidatorCache cache,
EnumSet<ValidationFeature> features)
Create a validation context with a defined set of features
|
ValidationContext(JsonValidatorCache cache,
EnumSet<ValidationFeature> features,
FormatBundle bundle) |
| Modifier and Type | Method and Description |
|---|---|
FormatAttribute |
getFormat(String fmt)
Return a format attribute for a given attribute
|
boolean |
hasFeature(ValidationFeature feature)
Test that the validation context contains a certain feature
|
JsonValidator |
newValidator(JsonNode node)
Build a new validator out of a JSON document
|
String |
toString() |
public ValidationContext(JsonValidatorCache cache)
cache - the validator cache to usepublic ValidationContext(JsonValidatorCache cache, EnumSet<ValidationFeature> features)
cache - the validator cache to usefeatures - the feature setpublic ValidationContext(JsonValidatorCache cache, EnumSet<ValidationFeature> features, FormatBundle bundle)
public boolean hasFeature(ValidationFeature feature)
feature - the feature to testpublic FormatAttribute getFormat(String fmt)
fmt - the format attributenull if not foundFormatBundlepublic 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.