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>>
com.vaadin.flow.data.binder.ValidationResultcheckGreaterThanMax(V value, V maxValue) Checks if the value being set to the component is greater than the max value definedstatic <V> com.vaadin.flow.data.binder.ValidationResultcheckRequired(boolean required, V value, V emptyValue) Checks the required validation constraintstatic <V extends Comparable<V>>
com.vaadin.flow.data.binder.ValidationResultcheckSmallerThanMin(V value, V minValue) Checks if the value being set to the component is smaller than the max value defined
-
Method Details
-
checkRequired
public static <V> com.vaadin.flow.data.binder.ValidationResult checkRequired(boolean required, V value, V emptyValue) 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
public static <V extends Comparable<V>> com.vaadin.flow.data.binder.ValidationResult checkGreaterThanMax(V value, V maxValue) 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
public static <V extends Comparable<V>> com.vaadin.flow.data.binder.ValidationResult checkSmallerThanMin(V value, V minValue) 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
-