vertx / io.vertx.reactivex.ext.web.api.validation / ParameterValidationRule

ParameterValidationRule

open class ParameterValidationRule

This function is an inner wrapper for ParameterTypeValidator inside ValidationHandler parameter maps. Don't instantiate this class, if you want to add custom ParameterTypeValidator to a parameter use functions in io.vertx.reactivex.ext.web.api.validation.HTTPRequestValidationHandler NOTE: This class has been automatically generated from the io.vertx.ext.web.api.validation.ParameterValidationRule non RX-ified interface using Vert.x codegen.

Constructors

<init>

ParameterValidationRule(delegate: ParameterValidationRule)

Properties

__TYPE_ARG

static val __TYPE_ARG: TypeArg<ParameterValidationRule>

Functions

allowEmptyValue

open fun allowEmptyValue(): Boolean

allowEmptyValue is used in query, header, cookie and form parameters. This is its behaviour:

  1. During validation, the ValidationHandler check if there's a parameter with combination of location and name as defined in this rule
  2. If it not exists, It will check allowEmptyValue and if there's a default value set inside ParameterTypeValidator:
    • If this condition it's true, It marks as validated the parameter and returns the default value (inside RequestParameter)
    • If this condition it's false, It throws ValidationException
  3. If the parameter exists, It checks if parameter is null or empty string:
    • If allowEmptyValue it's true, It marks as validated the parameter and returns the default value if it exists (inside RequestParameter)
    • If allowEmptyValue it's false, It throws ValidationException

equals

open fun equals(other: Any?): Boolean

getDelegate

open fun getDelegate(): ParameterValidationRule

getName

open fun getName(): String

This function return the name of the parameter expected into parameter lists

hashCode

open fun hashCode(): Int

isOptional

open fun isOptional(): Boolean

Return true if parameter is optional

newInstance

open static fun newInstance(arg: ParameterValidationRule): ParameterValidationRule

parameterTypeValidator

open fun parameterTypeValidator(): ParameterTypeValidator

Return ParameterTypeValidator instance used inside this parameter validation rule

toString

open fun toString(): String

validateArrayParam

open fun validateArrayParam(value: MutableList<String>): RequestParameter

This function will be called when there is a List that need to be validated. It must check if array is expected or not. It will throw a ValidationError in an error during validation occurs

validateSingleParam

open fun validateSingleParam(value: String): RequestParameter

This function will be called when there is only a string as parameter. It will throw a ValidationError in an error during validation occurs