Class ObjectValidatorFactory


  • public final class ObjectValidatorFactory
    extends Object
    ObjectValidatorFactory initialises the validator instances for given schemas.
    • Method Detail

      • getTypeValidator

        public static Validator getTypeValidator​(Map<String,​Object> schema)
        Returns a validator validating the schema.
        Parameters:
        schema - JSON Schema Draft-03 object
        Returns:
        Pre-configured Validator instance.
        Throws:
        NullPointerException - when the schema is null.
        RuntimeException - when the validators in the schema is not supported.
      • getTypeValidator

        public static Validator getTypeValidator​(Map<String,​Object> schema,
                                                 List<String> jsonPointer)
        Returns a validator validating the schema. It uses the passed in JSON pointer as a relative location of the validator in the schema.
        Parameters:
        schema - JSON Schema Draft-03 object
        jsonPointer - the list of tokens representing the JSON pointer leading to this validator
        Returns:
        Pre-configured Validator instance.
        Throws:
        NullPointerException - when the schema is null.
        RuntimeException - when the validators in the schema is not supported.
      • getTypeValidator

        public static Validator getTypeValidator​(String type,
                                                 Map<String,​Object> schema,
                                                 List<String> jsonPointer)
        Instantiates a validator of the passed in type with the given schema.
        Parameters:
        type - the type of Validator to instantiate
        schema - the schema that the instantiated validator will validate
        jsonPointer - the list of tokens representing the JSON pointer leading to this validator
        Returns:
        the instantiated validator. Cannot be null.
        Throws:
        RuntimeException - when the validators in the schema is not supported.