BEAN
- the bean type of the binderpublic class BinderValidationStatus<BEAN> extends Object implements Serializable
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.
BinderValidationStatusHandler
,
Binder.setValidationStatusHandler(BinderValidationStatusHandler)
,
Binder.validate()
,
BindingValidationStatus
,
Serialized FormConstructor and Description |
---|
BinderValidationStatus(Binder<BEAN> source,
List<BindingValidationStatus<?>> bindingStatuses,
List<ValidationResult> binderStatuses)
Creates a new binder validation status for the given binder and
validation results.
|
Modifier and Type | Method and 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.
|
boolean |
hasErrors()
Gets whether the validation for the binder failed or not.
|
boolean |
isOk()
Gets whether validation for the binder passed or not.
|
void |
notifyBindingValidationStatusHandlers()
Notifies all validation status handlers in bindings.
|
void |
notifyBindingValidationStatusHandlers(SerializablePredicate<BindingValidationStatus<?>> filter)
Notifies validation status handlers for bindings that pass given filter.
|
public BinderValidationStatus(Binder<BEAN> source, List<BindingValidationStatus<?>> bindingStatuses, List<ValidationResult> binderStatuses)
source
- the source binderbindingStatuses
- the validation results for the fieldsbinderStatuses
- the validation results for binder level validationpublic static <BEAN> BinderValidationStatus<BEAN> createUnresolvedStatus(Binder<BEAN> source)
In practice this status means that the values might not be valid, but validation errors should be hidden.
BEAN
- the bean type of the bindersource
- the source binderpublic boolean isOk()
true
if validation has passed, false
if notpublic boolean hasErrors()
true
if validation failed, false
if validation
passedpublic Binder<BEAN> getBinder()
public List<ValidationResult> getValidationErrors()
public List<BindingValidationStatus<?>> getFieldValidationStatuses()
The field level validtors have been added with
Binder.BindingBuilder.withValidator(Validator)
.
public List<ValidationResult> getBeanValidationResults()
public List<BindingValidationStatus<?>> getFieldValidationErrors()
The field level validtors have been added with
Binder.BindingBuilder.withValidator(Validator)
.
public List<ValidationResult> getBeanValidationErrors()
public void notifyBindingValidationStatusHandlers()
public void notifyBindingValidationStatusHandlers(SerializablePredicate<BindingValidationStatus<?>> filter)
true
for each
BindingValidationStatus
that should be delegated to the status
handler in the binding.filter
- the filter to select bindings to run status handling fornotifyBindingValidationStatusHandlers()
Copyright © 2023. All rights reserved.