Class ParameterTypeValidator
- java.lang.Object
-
- io.vertx.reactivex.ext.web.api.validation.ParameterTypeValidator
-
public class ParameterTypeValidator extends Object
Interface for declaration of method for validate a specific parameter type.
If you want to implement your own type validator, you need only to implementisValid(java.lang.String)
:- If parameter is valid, call 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
) and/or withValidationException.ErrorType
(). As for value, the validation flow will care about setting all other ValidationException fields
original
non RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<ParameterTypeValidator>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description ParameterTypeValidator(ParameterTypeValidator delegate)
ParameterTypeValidator(Object delegate)
-
Method Summary
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<ParameterTypeValidator> __TYPE_ARG
-
-
Constructor Detail
-
ParameterTypeValidator
public ParameterTypeValidator(ParameterTypeValidator delegate)
-
ParameterTypeValidator
public ParameterTypeValidator(Object delegate)
-
-
Method Detail
-
getDelegate
public ParameterTypeValidator getDelegate()
-
isValid
@Deprecated public RequestParameter isValid(String value)
Deprecated.Function that checks if parameter is valid. It returns a RequestParameter object that will be linked inside . For more info, check .- Parameters:
value
- value of parameter to test- Returns:
- request parameter value
-
isValidCollection
@Deprecated public RequestParameter isValidCollection(List<String> value)
Deprecated.Function that checks if array of values of a specific parameter. It returns a RequestParameter object that will be linked inside . For more info, check .- Parameters:
value
- list of values of parameter to test- Returns:
- request parameter value
-
getDefault
@Deprecated public Object getDefault()
Deprecated.Returns default value of parameter- Returns:
-
hasDefault
@Deprecated public boolean hasDefault()
Deprecated.Returns true if this type validator has default value- Returns:
-
createIntegerTypeValidator
@Deprecated public static ParameterTypeValidator createIntegerTypeValidator(Integer defaultValue)
Deprecated.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 setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createIntegerTypeValidator
@Deprecated public static ParameterTypeValidator createIntegerTypeValidator(Double maximum, Double minimum, Double multipleOf, Integer defaultValue)
Deprecated.Create a new type validator for integer values- Parameters:
maximum
- Maximum value. It can be nullminimum
- Minimum value. It can be nullmultipleOf
- Multiple of value. It can be nulldefaultValue
- Default value that will be set if parameter is empty or not found. To apply default value you have to setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createIntegerTypeValidator
@Deprecated public static ParameterTypeValidator createIntegerTypeValidator(Boolean exclusiveMaximum, Double maximum, Boolean exclusiveMinimum, Double minimum, Double multipleOf, Object defaultValue)
Deprecated.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 nullmaximum
- Maximum value. It can be nullexclusiveMinimum
- 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 nullminimum
- Minimum value. It can be nullmultipleOf
- Multiple of value. It can be nulldefaultValue
- Default value that will be set if parameter is empty or not found. To apply default value you have to setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createLongTypeValidator
@Deprecated public static ParameterTypeValidator createLongTypeValidator(Long defaultValue)
Deprecated.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 setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createLongTypeValidator
@Deprecated public static ParameterTypeValidator createLongTypeValidator(Double maximum, Double minimum, Double multipleOf, Long defaultValue)
Deprecated.Create a new type validator for long integer values- Parameters:
maximum
- Maximum value. It can be nullminimum
- Minimum value. It can be nullmultipleOf
- Multiple of value. It can be nulldefaultValue
- Default value that will be set if parameter is empty or not found. To apply default value you have to setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createLongTypeValidator
@Deprecated public static ParameterTypeValidator createLongTypeValidator(Boolean exclusiveMaximum, Double maximum, Boolean exclusiveMinimum, Double minimum, Double multipleOf, Object defaultValue)
Deprecated.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 nullmaximum
- Maximum value. It can be nullexclusiveMinimum
- 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 nullminimum
- Minimum value. It can be nullmultipleOf
- Multiple of value. It can be nulldefaultValue
- Default value that will be set if parameter is empty or not found. To apply default value you have to setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createFloatTypeValidator
@Deprecated public static ParameterTypeValidator createFloatTypeValidator(Float defaultValue)
Deprecated.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 setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createFloatTypeValidator
@Deprecated public static ParameterTypeValidator createFloatTypeValidator(Double maximum, Double minimum, Double multipleOf, Float defaultValue)
Deprecated.Create a new type validator for float values- Parameters:
maximum
- Maximum value. It can be nullminimum
- Minimum value. It can be nullmultipleOf
- Multiple of value. It can be nulldefaultValue
- Default value that will be set if parameter is empty or not found. To apply default value you have to setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createFloatTypeValidator
@Deprecated public static ParameterTypeValidator createFloatTypeValidator(Boolean exclusiveMaximum, Double maximum, Boolean exclusiveMinimum, Double minimum, Double multipleOf, Object defaultValue)
Deprecated.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 nullmaximum
- Maximum value. It can be nullexclusiveMinimum
- 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 nullminimum
- Minimum value. It can be nullmultipleOf
- Multiple of value. It can be nulldefaultValue
- Default value that will be set if parameter is empty or not found. To apply default value you have to setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createDoubleTypeValidator
@Deprecated public static ParameterTypeValidator createDoubleTypeValidator(Double defaultValue)
Deprecated.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 setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createDoubleTypeValidator
@Deprecated public static ParameterTypeValidator createDoubleTypeValidator(Double maximum, Double minimum, Double multipleOf, Double defaultValue)
Deprecated.Create a new type validator for double values- Parameters:
maximum
- Maximum value. It can be nullminimum
- Minimum value. It can be nullmultipleOf
- Multiple of value. It can be nulldefaultValue
- Default value that will be set if parameter is empty or not found. To apply default value you have to setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createDoubleTypeValidator
@Deprecated public static ParameterTypeValidator createDoubleTypeValidator(Boolean exclusiveMaximum, Double maximum, Boolean exclusiveMinimum, Double minimum, Double multipleOf, Object defaultValue)
Deprecated.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 nullmaximum
- Maximum value. It can be nullexclusiveMinimum
- 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 nullminimum
- Minimum value. It can be nullmultipleOf
- Multiple of value. It can be nulldefaultValue
- Default value that will be set if parameter is empty or not found. To apply default value you have to setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createStringTypeValidator
@Deprecated public static ParameterTypeValidator createStringTypeValidator(Object defaultValue)
Deprecated.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 setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createStringTypeValidator
@Deprecated public static ParameterTypeValidator createStringTypeValidator(String pattern, Object defaultValue)
Deprecated.Create a new string type validator- Parameters:
pattern
- pattern that string have to match. It can be nulldefaultValue
- Default value that will be set if parameter is empty or not found. To apply default value you have to setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createStringTypeValidator
@Deprecated public static ParameterTypeValidator createStringTypeValidator(String pattern, Integer minLength, Integer maxLength, Object defaultValue)
Deprecated.Create a new string type validator- Parameters:
pattern
- pattern that string have to match. It can be nullminLength
- Minimum length of string. It can be nullmaxLength
- Maximum length of string. It can be nulldefaultValue
- Default value that will be set if parameter is empty or not found. To apply default value you have to setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createBooleanTypeValidator
@Deprecated public static ParameterTypeValidator createBooleanTypeValidator(Object defaultValue)
Deprecated.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 setParameterValidationRule.allowEmptyValue()
true. It can be null- Returns:
-
createStringEnumTypeValidator
@Deprecated public static ParameterTypeValidator createStringEnumTypeValidator(List<String> allowedValues)
Deprecated.Create an enum type validator- Parameters:
allowedValues
- allowed values. It can't be null- Returns:
-
createEnumTypeValidatorWithInnerValidator
@Deprecated public static ParameterTypeValidator createEnumTypeValidatorWithInnerValidator(List<Object> allowedValues, ParameterTypeValidator innerValidator)
Deprecated.Create an enum type validator- Parameters:
allowedValues
- allowed values. It can't be nullinnerValidator
- After check if value is one of the lists, you can pass the value to an inner validator. It can be null- Returns:
-
createArrayTypeValidator
@Deprecated public static ParameterTypeValidator createArrayTypeValidator(ParameterTypeValidator arrayMembersValidator)
Deprecated.Create an array type validator- Parameters:
arrayMembersValidator
- Type validator that describe array items. It can't be null- Returns:
-
createArrayTypeValidator
@Deprecated public static ParameterTypeValidator createArrayTypeValidator(ParameterTypeValidator arrayMembersValidator, String collectionFormat, Integer maxItems, Integer minItems)
Deprecated.Create an array type validator- Parameters:
arrayMembersValidator
- Type validator that describe array items. It can't be nullcollectionFormat
- String that represent a ContainerSerializationStyle. Check outContainerSerializationStyle
for more informations. The default value is "csv". It can be nullmaxItems
- Maximum items in array. It can be nullminItems
- Minimum items in array. It can be null- Returns:
-
newInstance
public static ParameterTypeValidator newInstance(ParameterTypeValidator arg)
-
-