public class ValidationStateFailureCollector extends AbstractValidationStateCollector
ValidationState
that wraps an existing ValidationState
and allows to
collect the potential failures
for a part of the validation process. public booleanvalidate
(ValidationState
state) { if (state == null) { state = newValidationStateImpl
(); }ValidationStateFailureCollector
failureCollector = newValidationStateFailureCollector
(state); validateRecursive(failureCollector);List
<ValidationFailure
> childFailureList = failureCollector.getFailureList()
; if (!childFailureList.isEmpty()) { applyValidationFailures(childFailureList); } return failureCollector.isValid()
; }
Modifier and Type | Field and Description |
---|---|
private List<ValidationFailure> |
failureList |
Constructor and Description |
---|
ValidationStateFailureCollector(ValidationState delegate)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
List<ValidationFailure> |
getFailureList()
|
boolean |
isValid()
This method determines if the
validation has been
successful. |
void |
onFailure(ValidationFailure failure)
This method gets called if a
ValidationFailure occurred. |
String |
toString() |
getDelegate, getFailureCount
private final List<ValidationFailure> failureList
public ValidationStateFailureCollector(ValidationState delegate)
delegate
- is the ValidationState
to adapt.public void onFailure(ValidationFailure failure)
ValidationCollector
ValidationFailure
occurred.onFailure
in interface ValidationCollector
onFailure
in class AbstractValidationStateCollector
failure
- is the new ValidationFailure
.public boolean isValid()
AbstractValidationStateCollector
validation
has been
successful.
false
if a ValidationFailure
has been collected
by this instance. It may therefore return true
even if the delegate
would
return false
.isValid
in interface ValidationState
isValid
in class AbstractValidationStateCollector
true
if no ValidationFailure
has been collected
,
false
otherwise.public List<ValidationFailure> getFailureList()
List
of ValidationFailure
s.Copyright © 2001–2016 mmm-Team. All rights reserved.