Class EnumValidator

All Implemented Interfaces:
JsonValidator, JsonSchemaWalker

public class EnumValidator extends BaseJsonValidator implements JsonValidator
JsonValidator for enum.
  • Constructor Details

  • Method Details

    • validate

      public Set<ValidationMessage> validate(ExecutionContext executionContext, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, JsonNodePath instanceLocation)
      Description copied from interface: JsonValidator
      Validate the given JsonNode, the given node is the child node of the root node at given data path.
      Specified by:
      validate in interface JsonValidator
      Parameters:
      executionContext - ExecutionContext
      node - JsonNode
      rootNode - JsonNode
      instanceLocation - JsonNodePath
      Returns:
      A list of ValidationMessage if there is any validation error, or an empty list if there is no error.
    • 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