Package com.vaadin.data
Class BinderValidationStatus<BEAN>
- java.lang.Object
-
- com.vaadin.data.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 thefield levelandbinder levelvalidation.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:
- 8.0
- Author:
- Vaadin Ltd
- See Also:
BinderValidationStatusHandler,Binder.setValidationStatusHandler(BinderValidationStatusHandler),Binder.validate(),BindingValidationStatus, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BinderValidationStatus(Binder<BEAN> source, List<BindingValidationStatus<?>> bindingStatuses, List<ValidationResult> binderStatuses)Creates a new binder validation status for the given binder and validation results.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <BEAN> BinderValidationStatus<BEAN>createUnresolvedStatus(Binder<BEAN> source)Convenience method for creating a unresolved validation status for the given binder.List<ValidationResult>getBeanValidationErrors()Gets the failed bean level validation results.List<ValidationResult>getBeanValidationResults()Gets the bean level validation results.Binder<BEAN>getBinder()Gets the source binder of the status.List<BindingValidationStatus<?>>getFieldValidationErrors()Gets the failed field level validation statuses.List<BindingValidationStatus<?>>getFieldValidationStatuses()Gets the field level validation statuses.List<ValidationResult>getValidationErrors()Gets both field and bean level validation errors.booleanhasErrors()Gets whether the validation for the binder failed or not.booleanisOk()Gets whether validation for the binder passed or not.voidnotifyBindingValidationStatusHandlers()Notifies all validation status handlers in bindings.voidnotifyBindingValidationStatusHandlers(SerializablePredicate<BindingValidationStatus<?>> filter)Notifies validation status handlers for bindings that pass given filter.
-
-
-
Constructor Detail
-
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 Detail
-
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:
trueif validation has passed,falseif not
-
hasErrors
public boolean hasErrors()
Gets whether the validation for the binder failed or not.- Returns:
trueif validation failed,falseif 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 validators 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 validators 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.- Since:
- 8.2
- See Also:
notifyBindingValidationStatusHandlers(SerializablePredicate)
-
notifyBindingValidationStatusHandlers
public void notifyBindingValidationStatusHandlers(SerializablePredicate<BindingValidationStatus<?>> filter)
Notifies validation status handlers for bindings that pass given filter. The filter should returntruefor eachBindingValidationStatusthat should be delegated to the status handler in the binding.- Parameters:
filter- the filter to select bindings to run status handling for- Since:
- 8.2
- See Also:
notifyBindingValidationStatusHandlers()
-
-