public class ValidationResult extends Object
Modifier and Type | Field and Description |
---|---|
static ValidationResult |
OK
An empty ValidationResult that's valid by default.
|
Constructor and Description |
---|
ValidationResult(Set<ValidationError> errors)
Creates a new
ValidationResult from the given errors. |
Modifier and Type | Method and Description |
---|---|
void |
forEachError(Consumer<ValidationError> consumer)
Convenience method that accepts a
Consumer . |
Set<ValidationError> |
getErrors() |
Set<ValidationError> |
getErrorsForInputHint(String inputHint)
Returns a
Set of ValidationError's with the given inputHint if present, otherwise an empty Set is returned. |
Set<ValidationError> |
getErrorsForValidatorId(String id)
Returns a
Set of ValidationError's from the Validator with the given id if present, otherwise an empty Set is returned. |
boolean |
hasErrorsForInputHint(String inputHint)
|
boolean |
hasErrorsForValidatorId(String id)
|
void |
ifNotValidAccept(Consumer<ValidationResult> consumer)
Convenience method that accepts a
Consumer if the result is not valid. |
boolean |
isValid() |
public static final ValidationResult OK
public ValidationResult(Set<ValidationError> errors)
ValidationResult
from the given errors.
The created ValidationResult
is considered valid if the given errors
are empty.
errors
- public void ifNotValidAccept(Consumer<ValidationResult> consumer)
Consumer
if the result is not valid.consumer
- public void forEachError(Consumer<ValidationError> consumer)
Consumer
.consumer
- public boolean isValid()
public Set<ValidationError> getErrors()
public boolean hasErrorsForValidatorId(String id)
id
- public Set<ValidationError> getErrorsForValidatorId(String id)
Set
of ValidationError's
from the Validator
with the given id
if present, otherwise an empty Set
is returned.
id
- public boolean hasErrorsForInputHint(String inputHint)
ValidationResult
contains ValidationError's
with the given inputHint
.
This can be used to test if there are ValidationError's
for a specified attribute or attribute path.
inputHint
- public Set<ValidationError> getErrorsForInputHint(String inputHint)
Set
of ValidationError's
with the given inputHint
if present, otherwise an empty Set
is returned.
inputHint
- Copyright © 2021 JBoss by Red Hat. All rights reserved.