com.vaadin.flow.data.binder.
Class 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:
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 enum
Status 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 a
BindingValidationStatus.Status.UNRESOLVED
validation 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 is
BindingValidationStatus.Status.ERROR
.Gets the validation result if status is either
BindingValidationStatus.Status.OK
orBindingValidationStatus.Status.ERROR
or an empty optional if status isBindingValidationStatus.Status.UNRESOLVED
.Gets status of the validation.
Gets all the validation results related to this binding validation status.
boolean
isError()
Gets whether the validation failed or not.
-
Constructor Details
-
BindingValidationStatus
Creates a new status change event.
If
result
isnull
, thestatus
isBindingValidationStatus.Status.UNRESOLVED
.Parameters:
result
- the related result object, may benull
source
- field whose status has changed, notnull
-
-
Method Details
-
createUnresolvedStatus
public static <TARGET> BindingValidationStatus<TARGET> createUnresolvedStatus(Binder.Binding<?, TARGET> source) Convenience method for creating a
BindingValidationStatus.Status.UNRESOLVED
validation status for the given binding.Type Parameters:
TARGET
- the target data type of the binding for which the validation status was resetParameters:
source
- the source bindingReturns:
unresolved validation status
-
getStatus
Gets status of the validation.
Returns:
status
-
isError
public boolean isError()Gets whether the validation failed or not.
Returns:
true
if validation failed,false
if validation passed -
getMessage
Gets error validation message if status is
BindingValidationStatus.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 either
BindingValidationStatus.Status.OK
orBindingValidationStatus.Status.ERROR
or 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
-