vertx / io.vertx.ext.web.api.validation / ParameterTypeValidator

ParameterTypeValidator

@FunctionalInterface 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 ParameterTypeValidator#isValid(String):

Author
Francesco Guardiani @slinkydeveloper

Functions

createArrayTypeValidator

open static fun createArrayTypeValidator(arrayMembersValidator: ParameterTypeValidator): ParameterTypeValidator
open static fun createArrayTypeValidator(arrayMembersValidator: ParameterTypeValidator, collectionFormat: String, maxItems: Int, minItems: Int): ParameterTypeValidator

Create an array type validator

createBooleanTypeValidator

open static fun createBooleanTypeValidator(defaultValue: Any): ParameterTypeValidator

Create a boolean type validator

createDoubleTypeValidator

open static fun createDoubleTypeValidator(defaultValue: Double): ParameterTypeValidator
open static fun createDoubleTypeValidator(maximum: Double, minimum: Double, multipleOf: Double, defaultValue: Double): ParameterTypeValidator
open static fun createDoubleTypeValidator(exclusiveMaximum: Boolean, maximum: Double, exclusiveMinimum: Boolean, minimum: Double, multipleOf: Double, defaultValue: Any): ParameterTypeValidator

Create a new type validator for double values

createEnumTypeValidatorWithInnerValidator

open static fun createEnumTypeValidatorWithInnerValidator(allowedValues: MutableList<String>, innerValidator: ParameterTypeValidator): ParameterTypeValidator

Create an enum type validator

createFloatTypeValidator

open static fun createFloatTypeValidator(defaultValue: Float): ParameterTypeValidator
open static fun createFloatTypeValidator(maximum: Double, minimum: Double, multipleOf: Double, defaultValue: Float): ParameterTypeValidator
open static fun createFloatTypeValidator(exclusiveMaximum: Boolean, maximum: Double, exclusiveMinimum: Boolean, minimum: Double, multipleOf: Double, defaultValue: Any): ParameterTypeValidator

Create a new type validator for float values

createIntegerTypeValidator

open static fun createIntegerTypeValidator(defaultValue: Int): ParameterTypeValidator
open static fun createIntegerTypeValidator(maximum: Double, minimum: Double, multipleOf: Double, defaultValue: Int): ParameterTypeValidator
open static fun createIntegerTypeValidator(exclusiveMaximum: Boolean, maximum: Double, exclusiveMinimum: Boolean, minimum: Double, multipleOf: Double, defaultValue: Any): ParameterTypeValidator

Create a new type validator for integer values

createLongTypeValidator

open static fun createLongTypeValidator(defaultValue: Long): ParameterTypeValidator
open static fun createLongTypeValidator(maximum: Double, minimum: Double, multipleOf: Double, defaultValue: Long): ParameterTypeValidator
open static fun createLongTypeValidator(exclusiveMaximum: Boolean, maximum: Double, exclusiveMinimum: Boolean, minimum: Double, multipleOf: Double, defaultValue: Any): ParameterTypeValidator

Create a new type validator for long integer values

createStringEnumTypeValidator

open static fun createStringEnumTypeValidator(allowedValues: MutableList<String>): ParameterTypeValidator

Create an enum type validator

createStringTypeValidator

open static fun createStringTypeValidator(defaultValue: Any): ParameterTypeValidator
open static fun createStringTypeValidator(pattern: String, defaultValue: Any): ParameterTypeValidator
open static fun createStringTypeValidator(pattern: String, minLength: Int, maxLength: Int, defaultValue: Any): ParameterTypeValidator

Create a new string type validator

getDefault

open fun getDefault(): Any

Returns default value of parameter

hasDefault

open fun hasDefault(): Boolean

Returns true if this type validator has default value

isValid

abstract fun isValid(value: String): RequestParameter

Function that checks if parameter is valid. It returns a RequestParameter object that will be linked inside RequestParameters. For more info, check RequestParameter.

isValidCollection

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

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.