Class NullTypeValidator

  • All Implemented Interfaces:
    SimpleValidator<Object>

    public class NullTypeValidator
    extends Validator
    null Value MUST be null. Note this is mainly for purpose of being able use union types to define nullability. If this validators is not included in a union, null values are not allowed (the primitives do not allow nulls on their own.
    See Also:
    type
    • Constructor Detail

      • NullTypeValidator

        public NullTypeValidator​(Map<String,​Object> schema,
                                 List<String> jsonPointer)
        Construct a null type validator.
        Parameters:
        schema - The schema.
        jsonPointer - The pointer.
    • 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.

        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