Interface ValidationConfig

    • Field Detail

      • DEFAULT_VALUES

        static final String DEFAULT_VALUES
        The property used to specify whether JSON instances will be filled with default values or not.
        See Also:
        Constant Field Values
      • PROBLEM_HANDLER_FACTORY

        static final String PROBLEM_HANDLER_FACTORY
        The property used to specify the factory of problem handlers.
        See Also:
        Constant Field Values
    • Method Detail

      • getAsMap

        Map<String,​Object> getAsMap()
        Returns all configuration properties as an unmodifiable map.
        Returns:
        all configuration properties. This may be empty.
      • getProperty

        Optional<Object> getProperty​(String name)
        Returns the value of the specified configuration property.
        Parameters:
        name - the name of the property.
        Returns:
        The value of the requested property.
        Throws:
        NullPointerException - if the specified name is null.
      • setProperty

        ValidationConfig setProperty​(String name,
                                     Object value)
        Assigns the new value to the specified configuration property.
        Parameters:
        name - the name of the property.
        value - the value of the property.
        Returns:
        this builder.
        Throws:
        NullPointerException - if the specified name is null.
      • withProperties

        ValidationConfig withProperties​(Map<String,​?> properties)
        Assigns set of configuration properties.
        Parameters:
        properties - the configuration properties to assign, can be null.
        Returns:
        this builder.
      • withSchema

        ValidationConfig withSchema​(JsonSchema schema)
        Specifies the JSON schema used by the validators.
        Parameters:
        schema - the JSON schema.
        Returns:
        this builder.
        Throws:
        NullPointerException - if the specified schema is null.
      • withProblemHandler

        ValidationConfig withProblemHandler​(ProblemHandler handler)
        Specifies the handler of problems detected by the JSON validators. This method allows to be used if and only if all parsers and readers can safely share a single problem handler.
        Parameters:
        handler - the handler of problems, cannot be null.
        Returns:
        this builder.
        Throws:
        NullPointerException - if the specified handler is null.
      • withProblemHandlerFactory

        ValidationConfig withProblemHandlerFactory​(ProblemHandlerFactory handlerFactory)
        Specifies the factory of problem handlers. Problem handlers will be created for each instance of JsonParser and JsonReader.
        Parameters:
        handlerFactory - the factory of problem handlers, cannot be null
        Returns:
        this builder.
        Throws:
        NullPointerException - if the specified handlerFactory is null.
      • withDefaultValues

        ValidationConfig withDefaultValues​(boolean usingDefaultValues)
        Specifies whether JSON instances will be filled with default values while being validated or not. The default values are provided by default keywords in the schema. By default, the default values are ignored and the instances never be modified.
        Parameters:
        usingDefaultValues - true to fill the instances with default values provided by the schema. false to ingore default values.
        Returns:
        this builder.