public abstract class AbstractValidationStateCollector extends Object implements ValidationState
ValidationState
that wraps an existing ValidationState
and allows to collect the potential failures
for a part of the validation
process. Modifier and Type | Field and Description |
---|---|
private ValidationState |
delegate
The wrapped
ValidationState . |
Constructor and Description |
---|
AbstractValidationStateCollector(ValidationState delegate)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected ValidationState |
getDelegate() |
int |
getFailureCount() |
boolean |
isValid()
This method determines if the
validation has been
successful. |
void |
onFailure(ValidationFailure failure)
This method gets called if a
ValidationFailure occurred. |
private final ValidationState delegate
ValidationState
.public AbstractValidationStateCollector(ValidationState delegate)
delegate
- is the ValidationState
to adapt.protected ValidationState getDelegate()
ValidationState
to adapt. Each call to onFailure(ValidationFailure)
will also be
propagated to this delegate.public void onFailure(ValidationFailure failure)
ValidationCollector
ValidationFailure
occurred.onFailure
in interface ValidationCollector
failure
- is the new ValidationFailure
.public int getFailureCount()
getFailureCount
in interface ValidationCollector
ValidationFailure
s that have been collected
.public boolean isValid()
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
true
if no ValidationFailure
has been collected
,
false
otherwise.Copyright © 2001–2016 mmm-Team. All rights reserved.