Package com.vaadin.flow.data.binder
Class BinderValidationStatus<BEAN>
java.lang.Object
com.vaadin.flow.data.binder.BinderValidationStatus<BEAN>
- Type Parameters:
BEAN
- the bean type of the binder
- All Implemented Interfaces:
Serializable
Binder validation status change. Represents the outcome of binder level
validation. Has information about the validation results for the
field level
and
binder level
validation.
Note: if there are any field level validation errors, the bean level validation is not run.
Note: if the status change is triggered via automatic validation due to a changed field value, the field validation statuses will only cover the changed fields.
Use Binder.setValidationStatusHandler(BinderValidationStatusHandler)
to handle form level validation status changes.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorDescriptionBinderValidationStatus
(Binder<BEAN> source, List<BindingValidationStatus<?>> bindingStatuses, List<ValidationResult> binderStatuses) Creates a new binder validation status for the given binder and validation results. -
Method Summary
Modifier and TypeMethodDescriptionstatic <BEAN> BinderValidationStatus<BEAN>
createUnresolvedStatus
(Binder<BEAN> source) Convenience method for creating a unresolved validation status for the given binder.Gets the failed bean level validation results.Gets the bean level validation results.Gets the source binder of the status.Gets the failed field level validation statuses.Gets the field level validation statuses.Gets both field and bean level validation errors.boolean
Gets whether the validation for the binder failed or not.boolean
isOk()
Gets whether validation for the binder passed or not.void
Notifies all validation status handlers in bindings.void
Notifies validation status handlers for bindings that pass given filter.
-
Constructor Details
-
BinderValidationStatus
public BinderValidationStatus(Binder<BEAN> source, List<BindingValidationStatus<?>> bindingStatuses, List<ValidationResult> binderStatuses) Creates a new binder validation status for the given binder and validation results.- Parameters:
source
- the source binderbindingStatuses
- the validation results for the fieldsbinderStatuses
- the validation results for binder level validation
-
-
Method Details
-
createUnresolvedStatus
Convenience method for creating a unresolved validation status for the given binder.In practice this status means that the values might not be valid, but validation errors should be hidden.
- Type Parameters:
BEAN
- the bean type of the binder- Parameters:
source
- the source binder- Returns:
- a unresolved validation status
-
isOk
public boolean isOk()Gets whether validation for the binder passed or not.- Returns:
true
if validation has passed,false
if not
-
hasErrors
public boolean hasErrors()Gets whether the validation for the binder failed or not.- Returns:
true
if validation failed,false
if validation passed
-
getBinder
Gets the source binder of the status.- Returns:
- the source binder
-
getValidationErrors
Gets both field and bean level validation errors.- Returns:
- a list of all validation errors
-
getFieldValidationStatuses
Gets the field level validation statuses.The field level validtors have been added with
Binder.BindingBuilder.withValidator(Validator)
.- Returns:
- the field validation statuses
-
getBeanValidationResults
Gets the bean level validation results.- Returns:
- the bean level validation results
-
getFieldValidationErrors
Gets the failed field level validation statuses.The field level validtors have been added with
Binder.BindingBuilder.withValidator(Validator)
.- Returns:
- a list of failed field level validation statuses
-
getBeanValidationErrors
Gets the failed bean level validation results.- Returns:
- a list of failed bean level validation results
-
notifyBindingValidationStatusHandlers
public void notifyBindingValidationStatusHandlers()Notifies all validation status handlers in bindings. -
notifyBindingValidationStatusHandlers
public void notifyBindingValidationStatusHandlers(SerializablePredicate<BindingValidationStatus<?>> filter) Notifies validation status handlers for bindings that pass given filter. The filter should returntrue
for eachBindingValidationStatus
that should be delegated to the status handler in the binding.- Parameters:
filter
- the filter to select bindings to run status handling for- See Also:
-