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

public class BinderValidationStatus<BEAN> extends Object implements 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.

Use Binder.setValidationStatusHandler(BinderValidationStatusHandler) to handle form level validation status changes.

Since:
1.0
Author:
Vaadin Ltd
See Also:
  • 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 binder
      bindingStatuses - the validation results for the fields
      binderStatuses - the validation results for binder level validation
  • Method Details

    • createUnresolvedStatus

      public static <BEAN> BinderValidationStatus<BEAN> createUnresolvedStatus(Binder<BEAN> source)
      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

      public Binder<BEAN> getBinder()
      Gets the source binder of the status.
      Returns:
      the source binder
    • getValidationErrors

      public List<ValidationResult> getValidationErrors()
      Gets both field and bean level validation errors.
      Returns:
      a list of all validation errors
    • getFieldValidationStatuses

      public List<BindingValidationStatus<?>> 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

      public List<ValidationResult> getBeanValidationResults()
      Gets the bean level validation results.
      Returns:
      the bean level validation results
    • getFieldValidationErrors

      public List<BindingValidationStatus<?>> 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

      public List<ValidationResult> 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.
      See Also:
    • notifyBindingValidationStatusHandlers

      public void notifyBindingValidationStatusHandlers(SerializablePredicate<BindingValidationStatus<?>> filter)
      Notifies validation status handlers for bindings that pass given filter. The filter should return true for each BindingValidationStatus 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: