Class IntegerTypeValidator

  • All Implemented Interfaces:
    SimpleValidator<Object>

    public class IntegerTypeValidator
    extends Validator
    IntegerTypeValidator applies all the constraints of a integer type.

    Sample JSON Schema:

    { "type" : "integer", "required" : false, "minimum" : -500, "maximum" : 753, "exclusiveMinimum" : false, "exclusiveMaximum" : true, "divisibleBy" : 3, "enum" : [ 12, 333, 492 ] }
    See Also:
    type
    • Constructor Detail

      • IntegerTypeValidator

        public IntegerTypeValidator​(Map<String,​Object> schema,
                                    List<String> jsonPointer)
        Create an integer type validator.
        Parameters:
        schema - The schema.
        jsonPointer - The pointer.
    • Method Detail

      • validate

        public void validate​(Object node,
                             JsonPointer at,
                             ErrorHandler handler)
                      throws SchemaException
        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.

        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