Package com.networknt.schema.keyword
Class EnumValidator
java.lang.Object
com.networknt.schema.keyword.AbstractKeywordValidator
com.networknt.schema.keyword.BaseKeywordValidator
com.networknt.schema.keyword.EnumValidator
- All Implemented Interfaces:
KeywordValidator,Validator,Walker
KeywordValidator for enum.-
Field Summary
Fields inherited from class com.networknt.schema.keyword.BaseKeywordValidator
errorMessage, parentSchema, schemaContextFields inherited from class com.networknt.schema.keyword.AbstractKeywordValidator
schemaLocation, schemaNode -
Constructor Summary
ConstructorsConstructorDescriptionEnumValidator(SchemaLocation schemaLocation, com.fasterxml.jackson.databind.JsonNode schemaNode, Schema parentSchema, SchemaContext schemaContext) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanhasNumber(com.fasterxml.jackson.databind.node.ArrayNode node) Determines if the array node contains a number.protected com.fasterxml.jackson.databind.node.ArrayNodeprocessArrayNode(com.fasterxml.jackson.databind.node.ArrayNode node) Processes the array and ensures that numbers within have trailing zeroes stripped.protected com.fasterxml.jackson.databind.JsonNodeprocessNumberNode(com.fasterxml.jackson.databind.JsonNode n) Processes the number and ensures trailing zeros are stripped.voidvalidate(ExecutionContext executionContext, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, NodePath instanceLocation) Validate the instance node which belongs to the instance document at the instance location.Methods inherited from class com.networknt.schema.keyword.BaseKeywordValidator
error, getNodeFieldType, getParentSchema, preloadSchemasMethods inherited from class com.networknt.schema.keyword.AbstractKeywordValidator
collectAnnotations, collectAnnotations, getKeyword, getSchemaLocation, getSchemaNode, hasAdjacentKeywordInEvaluationPath, hasUnevaluatedItemsInEvaluationPath, hasUnevaluatedPropertiesInEvaluationPath, putAnnotation, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.networknt.schema.keyword.KeywordValidator
getKeyword, preloadSchemaMethods inherited from interface com.networknt.schema.Validator
getSchemaLocation, walk
-
Constructor Details
-
EnumValidator
public EnumValidator(SchemaLocation schemaLocation, com.fasterxml.jackson.databind.JsonNode schemaNode, Schema parentSchema, SchemaContext schemaContext)
-
-
Method Details
-
validate
public void validate(ExecutionContext executionContext, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, NodePath instanceLocation) Description copied from interface:ValidatorValidate the instance node which belongs to the instance document at the instance location. -
processNumberNode
protected com.fasterxml.jackson.databind.JsonNode processNumberNode(com.fasterxml.jackson.databind.JsonNode n) Processes the number and ensures trailing zeros are stripped.- Parameters:
n- the node- Returns:
- the node
-
processArrayNode
protected com.fasterxml.jackson.databind.node.ArrayNode processArrayNode(com.fasterxml.jackson.databind.node.ArrayNode node) Processes the array and ensures that numbers within have trailing zeroes stripped.- Parameters:
node- the node- Returns:
- the node
-
hasNumber
protected boolean hasNumber(com.fasterxml.jackson.databind.node.ArrayNode node) Determines if the array node contains a number.- Parameters:
node- the node- Returns:
- the node
-