Class EnumHelper

  • All Implemented Interfaces:
    SimpleValidator<Object>

    public class EnumHelper
    extends Object
    implements SimpleValidator<Object>
    This class implements "enum" validation on all types of objects as defined in the paragraph 5.19 of the JSON Schema specification.

    This implementation relies on the equals method.

    See Also:
    enum
    • Constructor Detail

      • EnumHelper

        public EnumHelper​(List<Object> enumValues)
        Construct a new enum helper.
        Parameters:
        enumValues - The values.
    • Method Detail

      • validate

        public void validate​(Object node,
                             JsonPointer at,
                             ErrorHandler handler)
                      throws SchemaException
        Description copied from interface: SimpleValidator
        Validates the node value against the embedded schema object.

        The selected error handler defines the behaviour of the validator. The FailFastErrorHandler throws exception at firs violation. Other customised ErrorHandler can collect all exceptions and after the validation the examination of the handler contains the final result.

        Specified by:
        validate in interface SimpleValidator<Object>
        Parameters:
        node - value to validate
        at - JSONPath of the node. null means it's the root node
        handler - customised error handler like FailFastErrorHandler
        Throws:
        SchemaException - when the node violates with the schema