com.vaadin.flow.component.shared.
Class ValidationUtil
- java.lang.Object
-
- com.vaadin.flow.component.shared.ValidationUtil
-
public class ValidationUtil extends Object
Util methods for component validation
-
-
Method Summary
All Methods Modifier and Type Method Description static <V extends Comparable<V>>
ValidationResultcheckGreaterThanMax(V value, V maxValue)
Checks if the value being set to the component is greater than the max value defined
static <V> ValidationResult
checkRequired(boolean required, V value, V emptyValue)
Checks the required validation constraint
static <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 Detail
-
checkRequired
public static <V> ValidationResult checkRequired(boolean required, V value, V emptyValue)
Checks the required validation constraint
Type Parameters:
V
- the type of the component valueParameters:
required
- the required state of the componentvalue
- the current value set on the componentemptyValue
- the empty value for the componentReturns:
Validation.ok()
if the validation passes,Validation.error()
otherwise
-
checkGreaterThanMax
public static <V extends Comparable<V>> 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 valueParameters:
value
- the current value set on the componentmaxValue
- the max value set on the componentReturns:
Validation.ok()
if the validation passes,Validation.error()
otherwise
-
checkSmallerThanMin
public static <V extends Comparable<V>> 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 valueParameters:
value
- the current value set on the componentminValue
- the min value set on the componentReturns:
Validation.ok()
if the validation passes,Validation.error()
otherwise
-
-