io.vertx.ext.web.api.validation

## Interface ParameterTypeValidator

- Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

      @FunctionalInterface
      public interface ParameterTypeValidator

  Interface for declaration of method for validate a specific parameter type.
  If you want to implement your own type validator, you need only to implement `isValid(String)`:
  - If parameter is valid, call `RequestParameter.create(Object)` to put value (maybe modified) inside RequestParameters. The validation flow will care about set parameter name
  - If parameter is invalid, throw a new ValidationException with message (`ValidationException(String)`) and/or with `ValidationException.ErrorType` (`ValidationException(String, ValidationException.ErrorType)`). As for value, the validation flow will care about setting all other ValidationException fields
  Author:
    Francesco Guardiani @slinkydeveloper

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ParameterTypeValidator` | `createArrayTypeValidator(ParameterTypeValidator arrayMembersValidator)` Create an array type validator
    `static ParameterTypeValidator` | `createArrayTypeValidator(ParameterTypeValidator arrayMembersValidator, String collectionFormat, Integer maxItems, Integer minItems)` Create an array type validator
    `static ParameterTypeValidator` | `createBooleanTypeValidator(Object defaultValue)` Create a boolean type validator
    `static ParameterTypeValidator` | `createDoubleTypeValidator(Boolean exclusiveMaximum, Double maximum, Boolean exclusiveMinimum, Double minimum, Double multipleOf, Object defaultValue)` Create a new type validator for double values
    `static ParameterTypeValidator` | `createDoubleTypeValidator(Double defaultValue)` Create a new type validator for double values
    `static ParameterTypeValidator` | `createDoubleTypeValidator(Double maximum, Double minimum, Double multipleOf, Double defaultValue)` Create a new type validator for double values
    `static ParameterTypeValidator` | `createEnumTypeValidatorWithInnerValidator(List<Object> allowedValues, ParameterTypeValidator innerValidator)` Create an enum type validator
    `static ParameterTypeValidator` | `createFloatTypeValidator(Boolean exclusiveMaximum, Double maximum, Boolean exclusiveMinimum, Double minimum, Double multipleOf, Object defaultValue)` Create a new type validator for float values
    `static ParameterTypeValidator` | `createFloatTypeValidator(Double maximum, Double minimum, Double multipleOf, Float defaultValue)` Create a new type validator for float values
    `static ParameterTypeValidator` | `createFloatTypeValidator(Float defaultValue)` Create a new type validator for float values
    `static ParameterTypeValidator` | `createIntegerTypeValidator(Boolean exclusiveMaximum, Double maximum, Boolean exclusiveMinimum, Double minimum, Double multipleOf, Object defaultValue)` Create a new type validator for integer values
    `static ParameterTypeValidator` | `createIntegerTypeValidator(Double maximum, Double minimum, Double multipleOf, Integer defaultValue)` Create a new type validator for integer values
    `static ParameterTypeValidator` | `createIntegerTypeValidator(Integer defaultValue)` Create a new type validator for integer values
    `static ParameterTypeValidator` | `createLongTypeValidator(Boolean exclusiveMaximum, Double maximum, Boolean exclusiveMinimum, Double minimum, Double multipleOf, Object defaultValue)` Create a new type validator for long integer values
    `static ParameterTypeValidator` | `createLongTypeValidator(Double maximum, Double minimum, Double multipleOf, Long defaultValue)` Create a new type validator for long integer values
    `static ParameterTypeValidator` | `createLongTypeValidator(Long defaultValue)` Create a new type validator for long integer values
    `static ParameterTypeValidator` | `createStringEnumTypeValidator(List<String> allowedValues)` Create an enum type validator
    `static ParameterTypeValidator` | `createStringTypeValidator(Object defaultValue)` Create a new string type validator
    `static ParameterTypeValidator` | `createStringTypeValidator(String pattern, Integer minLength, Integer maxLength, Object defaultValue)` Create a new string type validator
    `static ParameterTypeValidator` | `createStringTypeValidator(String pattern, Object defaultValue)` Create a new string type validator
    `default Object` | `getDefault()` Returns default value of parameter
    `default boolean` | `hasDefault()` Returns true if this type validator has default value
    `RequestParameter` | `isValid(String value)` Function that checks if parameter is valid.
    `default RequestParameter` | `isValidCollection(List<String> value)` Function that checks if array of values of a specific parameter.

- - ### Method Detail

    - #### isValid

          RequestParameter isValid(String value)
                            throws ValidationException

      Function that checks if parameter is valid. It returns a RequestParameter object that will be linked inside `RequestParameters`. For more info, check `RequestParameter`.
      Parameters:
        `value` - value of parameter to test
      Returns:
        request parameter value
      Throws:
        `ValidationException`

    - #### isValidCollection

          default RequestParameter isValidCollection(List<String> value)
                                              throws ValidationException

      Function that checks if array of values of a specific parameter. It returns a RequestParameter object that will be linked inside `RequestParameters`. For more info, check `RequestParameter`.
      Parameters:
        `value` - list of values of parameter to test
      Returns:
        request parameter value
      Throws:
        `ValidationException`

    - #### getDefault

          default Object getDefault()

      Returns default value of parameter
      Returns:

    - #### hasDefault

          default boolean hasDefault()

      Returns true if this type validator has default value
      Returns:

    - #### createIntegerTypeValidator

          static ParameterTypeValidator createIntegerTypeValidator(Integer defaultValue)

      Create a new type validator for integer values
      Parameters:
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createIntegerTypeValidator

          static ParameterTypeValidator createIntegerTypeValidator(Double maximum,
                                                                   Double minimum,
                                                                   Double multipleOf,
                                                                   Integer defaultValue)

      Create a new type validator for integer values
      Parameters:
        `maximum` - Maximum value. It can be null
        `minimum` - Minimum value. It can be null
        `multipleOf` - Multiple of value. It can be null
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createIntegerTypeValidator

          static ParameterTypeValidator createIntegerTypeValidator(Boolean exclusiveMaximum,
                                                                   Double maximum,
                                                                   Boolean exclusiveMinimum,
                                                                   Double minimum,
                                                                   Double multipleOf,
                                                                   Object defaultValue)

      Create a new type validator for integer values
      Parameters:
        `exclusiveMaximum` - If true, value will be mark as valid if value < maximum. If false, value will be mark as valid if value <= maximum. The default value is false. It can be null
        `maximum` - Maximum value. It can be null
        `exclusiveMinimum` - If true, value will be mark as valid if value > minimum. If false, value will be mark as valid if value >= minimum. The default value is false. It can be null
        `minimum` - Minimum value. It can be null
        `multipleOf` - Multiple of value. It can be null
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createLongTypeValidator

          static ParameterTypeValidator createLongTypeValidator(Long defaultValue)

      Create a new type validator for long integer values
      Parameters:
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createLongTypeValidator

          static ParameterTypeValidator createLongTypeValidator(Double maximum,
                                                                Double minimum,
                                                                Double multipleOf,
                                                                Long defaultValue)

      Create a new type validator for long integer values
      Parameters:
        `maximum` - Maximum value. It can be null
        `minimum` - Minimum value. It can be null
        `multipleOf` - Multiple of value. It can be null
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createLongTypeValidator

          static ParameterTypeValidator createLongTypeValidator(Boolean exclusiveMaximum,
                                                                Double maximum,
                                                                Boolean exclusiveMinimum,
                                                                Double minimum,
                                                                Double multipleOf,
                                                                Object defaultValue)

      Create a new type validator for long integer values
      Parameters:
        `exclusiveMaximum` - If true, value will be mark as valid if value < maximum. If false, value will be mark as valid if value <= maximum. The default value is false. It can be null
        `maximum` - Maximum value. It can be null
        `exclusiveMinimum` - If true, value will be mark as valid if value > minimum. If false, value will be mark as valid if value >= minimum. The default value is false. It can be null
        `minimum` - Minimum value. It can be null
        `multipleOf` - Multiple of value. It can be null
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createFloatTypeValidator

          static ParameterTypeValidator createFloatTypeValidator(Float defaultValue)

      Create a new type validator for float values
      Parameters:
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createFloatTypeValidator

          static ParameterTypeValidator createFloatTypeValidator(Double maximum,
                                                                 Double minimum,
                                                                 Double multipleOf,
                                                                 Float defaultValue)

      Create a new type validator for float values
      Parameters:
        `maximum` - Maximum value. It can be null
        `minimum` - Minimum value. It can be null
        `multipleOf` - Multiple of value. It can be null
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createFloatTypeValidator

          static ParameterTypeValidator createFloatTypeValidator(Boolean exclusiveMaximum,
                                                                 Double maximum,
                                                                 Boolean exclusiveMinimum,
                                                                 Double minimum,
                                                                 Double multipleOf,
                                                                 Object defaultValue)

      Create a new type validator for float values
      Parameters:
        `exclusiveMaximum` - If true, value will be mark as valid if value < maximum. If false, value will be mark as valid if value <= maximum. The default value is false. It can be null
        `maximum` - Maximum value. It can be null
        `exclusiveMinimum` - If true, value will be mark as valid if value > minimum. If false, value will be mark as valid if value >= minimum. The default value is false. It can be null
        `minimum` - Minimum value. It can be null
        `multipleOf` - Multiple of value. It can be null
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createDoubleTypeValidator

          static ParameterTypeValidator createDoubleTypeValidator(Double defaultValue)

      Create a new type validator for double values
      Parameters:
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createDoubleTypeValidator

          static ParameterTypeValidator createDoubleTypeValidator(Double maximum,
                                                                  Double minimum,
                                                                  Double multipleOf,
                                                                  Double defaultValue)

      Create a new type validator for double values
      Parameters:
        `maximum` - Maximum value. It can be null
        `minimum` - Minimum value. It can be null
        `multipleOf` - Multiple of value. It can be null
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createDoubleTypeValidator

          static ParameterTypeValidator createDoubleTypeValidator(Boolean exclusiveMaximum,
                                                                  Double maximum,
                                                                  Boolean exclusiveMinimum,
                                                                  Double minimum,
                                                                  Double multipleOf,
                                                                  Object defaultValue)

      Create a new type validator for double values
      Parameters:
        `exclusiveMaximum` - If true, value will be mark as valid if value < maximum. If false, value will be mark as valid if value <= maximum. The default value is false. It can be null
        `maximum` - Maximum value. It can be null
        `exclusiveMinimum` - If true, value will be mark as valid if value > minimum. If false, value will be mark as valid if value >= minimum. The default value is false. It can be null
        `minimum` - Minimum value. It can be null
        `multipleOf` - Multiple of value. It can be null
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createStringTypeValidator

          static ParameterTypeValidator createStringTypeValidator(Object defaultValue)

      Create a new string type validator
      Parameters:
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createStringTypeValidator

          static ParameterTypeValidator createStringTypeValidator(String pattern,
                                                                  Object defaultValue)

      Create a new string type validator
      Parameters:
        `pattern` - pattern that string have to match. It can be null
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createStringTypeValidator

          static ParameterTypeValidator createStringTypeValidator(String pattern,
                                                                  Integer minLength,
                                                                  Integer maxLength,
                                                                  Object defaultValue)

      Create a new string type validator
      Parameters:
        `pattern` - pattern that string have to match. It can be null
        `minLength` - Minimum length of string. It can be null
        `maxLength` - Maximum length of string. It can be null
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createBooleanTypeValidator

          static ParameterTypeValidator createBooleanTypeValidator(Object defaultValue)

      Create a boolean type validator
      Parameters:
        `defaultValue` - Default value that will be set if parameter is empty or not found. To apply default value you have to set `ParameterValidationRule.allowEmptyValue()` true. It can be null
      Returns:

    - #### createStringEnumTypeValidator

          static ParameterTypeValidator createStringEnumTypeValidator(List<String> allowedValues)

      Create an enum type validator
      Parameters:
        `allowedValues` - allowed values. It can't be null
      Returns:

    - #### createEnumTypeValidatorWithInnerValidator

          static ParameterTypeValidator createEnumTypeValidatorWithInnerValidator(List<Object> allowedValues,
                                                                                  ParameterTypeValidator innerValidator)

      Create an enum type validator
      Parameters:
        `allowedValues` - allowed values. It can't be null
        `innerValidator` - After check if value is one of the lists, you can pass the value to an inner validator. It can be null
      Returns:

    - #### createArrayTypeValidator

          static ParameterTypeValidator createArrayTypeValidator(ParameterTypeValidator arrayMembersValidator)

      Create an array type validator
      Parameters:
        `arrayMembersValidator` - Type validator that describe array items. It can't be null
      Returns:

    - #### createArrayTypeValidator

          static ParameterTypeValidator createArrayTypeValidator(ParameterTypeValidator arrayMembersValidator,
                                                                 String collectionFormat,
                                                                 Integer maxItems,
                                                                 Integer minItems)

      Create an array type validator
      Parameters:
        `arrayMembersValidator` - Type validator that describe array items. It can't be null
        `collectionFormat` - String that represent a ContainerSerializationStyle. Check out `ContainerSerializationStyle` for more informations. The default value is "csv". It can be null
        `maxItems` - Maximum items in array. It can be null
        `minItems` - Minimum items in array. It can be null
      Returns:

Copyright © 2021 Eclipse. All rights reserved.