Package com.vaadin.flow.component.shared
Class ValidationUtil
java.lang.Object
com.vaadin.flow.component.shared.ValidationUtil
Util methods for component validation
-
Method Summary
Modifier and TypeMethodDescriptionstatic <V extends Comparable<V>>
ValidationResultcheckGreaterThanMax
(V value, V maxValue) Checks if the value being set to the component is greater than the max value definedstatic <V> ValidationResult
checkRequired
(boolean required, V value, V emptyValue) Checks the required validation constraintstatic <V extends Comparable<V>>
ValidationResultcheckSmallerThanMin
(V value, V minValue) Checks if the value being set to the component is smaller than the max value defined
-
Method Details
-
checkRequired
Checks the required validation constraint- Type Parameters:
V
- the type of the component value- Parameters:
required
- the required state of the componentvalue
- the current value set on the componentemptyValue
- the empty value for the component- Returns:
Validation.ok()
if the validation passes,Validation.error()
otherwise
-
checkGreaterThanMax
Checks if the value being set to the component is greater than the max value defined- Type Parameters:
V
- the type of the component value- Parameters:
value
- the current value set on the componentmaxValue
- the max value set on the component- Returns:
Validation.ok()
if the validation passes,Validation.error()
otherwise
-
checkSmallerThanMin
Checks if the value being set to the component is smaller than the max value defined- Type Parameters:
V
- the type of the component value- Parameters:
value
- the current value set on the componentminValue
- the min value set on the component- Returns:
Validation.ok()
if the validation passes,Validation.error()
otherwise
-