Package com.vaadin.flow.data.binder
Class BindingValidationStatus<TARGET>
java.lang.Object
com.vaadin.flow.data.binder.BindingValidationStatus<TARGET>
- Type Parameters:
TARGET- the target data type of the binding for which the validation status changed, matches the field type unless a converter has been set
- All Implemented Interfaces:
Serializable
Represents the status of field validation. Status can be
Status.OK,
Status.ERROR or Status.UNRESOLVED. Status OK and ERROR are
always associated with a ValidationResult getResult().
Use
Binder.BindingBuilder.withValidationStatusHandler(BindingValidationStatusHandler)
to register a handler for field level validation status changes.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumStatus of the validation. -
Constructor Summary
ConstructorsConstructorDescriptionBindingValidationStatus(Result<TARGET> result, Binder.Binding<?, TARGET> source) Creates a new status change event. -
Method Summary
Modifier and TypeMethodDescriptionstatic <TARGET> BindingValidationStatus<TARGET> createUnresolvedStatus(Binder.Binding<?, TARGET> source) Convenience method for creating aBindingValidationStatus.Status.UNRESOLVEDvalidation status for the given binding.Gets the source binding of the validation status.HasValue<?, ?> getField()Gets the bound field for this status.Gets error validation message if status isBindingValidationStatus.Status.ERROR.Gets the validation result if status is eitherBindingValidationStatus.Status.OKorBindingValidationStatus.Status.ERRORor an empty optional if status isBindingValidationStatus.Status.UNRESOLVED.Gets status of the validation.Gets all the validation results related to this binding validation status.booleanisError()Gets whether the validation failed or not.
-
Constructor Details
-
BindingValidationStatus
Creates a new status change event.If
resultisnull, thestatusisBindingValidationStatus.Status.UNRESOLVED.- Parameters:
result- the related result object, may benullsource- field whose status has changed, notnull
-
-
Method Details
-
createUnresolvedStatus
public static <TARGET> BindingValidationStatus<TARGET> createUnresolvedStatus(Binder.Binding<?, TARGET> source) Convenience method for creating aBindingValidationStatus.Status.UNRESOLVEDvalidation status for the given binding.- Type Parameters:
TARGET- the target data type of the binding for which the validation status was reset- Parameters:
source- the source binding- Returns:
- unresolved validation status
-
getStatus
Gets status of the validation.- Returns:
- status
-
isError
public boolean isError()Gets whether the validation failed or not.- Returns:
trueif validation failed,falseif validation passed
-
getMessage
Gets error validation message if status isBindingValidationStatus.Status.ERROR.- Returns:
- an optional validation error status or an empty optional if status is not an error
-
getResult
Gets the validation result if status is eitherBindingValidationStatus.Status.OKorBindingValidationStatus.Status.ERRORor an empty optional if status isBindingValidationStatus.Status.UNRESOLVED.- Returns:
- the validation result
-
getValidationResults
Gets all the validation results related to this binding validation status.- Returns:
- list of validation results
-
getBinding
Gets the source binding of the validation status.- Returns:
- the source binding
-
getField
Gets the bound field for this status.- Returns:
- the field
-