Package org.keycloak.validate
Class ValidationResult
java.lang.Object
org.keycloak.validate.ValidationResult
Denotes the result of a validation.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ValidationResult
An empty ValidationResult that's valid by default. -
Constructor Summary
ConstructorDescriptionValidationResult
(Set<ValidationError> errors) Creates a newValidationResult
from the given errors. -
Method Summary
Modifier and TypeMethodDescriptionvoid
forEachError
(Consumer<ValidationError> consumer) Convenience method that accepts aConsumer<ValidationError>
.getErrorsForInputHint
(String inputHint) Returns aSet
ofValidationError's
with the giveninputHint
if present, otherwise an emptySet
is returned.Returns aSet
ofValidationError's
from theValidator
with the givenid
if present, otherwise an emptySet
is returned.boolean
hasErrorsForInputHint
(String inputHint) boolean
void
ifNotValidAccept
(Consumer<ValidationResult> consumer) Convenience method that accepts aConsumer<ValidationResult>
if the result is not valid.boolean
isValid()
-
Field Details
-
OK
An empty ValidationResult that's valid by default.
-
-
Constructor Details
-
ValidationResult
Creates a newValidationResult
from the given errors.The created
ValidationResult
is considered valid if the givenerrors
are empty.- Parameters:
errors
-
-
-
Method Details
-
ifNotValidAccept
Convenience method that accepts aConsumer<ValidationResult>
if the result is not valid.- Parameters:
consumer
-
-
forEachError
Convenience method that accepts aConsumer<ValidationError>
.- Parameters:
consumer
-
-
isValid
public boolean isValid() -
getErrors
-
hasErrorsForValidatorId
- Parameters:
id
-- Returns:
-
getErrorsForValidatorId
Returns aSet
ofValidationError's
from theValidator
with the givenid
if present, otherwise an emptySet
is returned.- Parameters:
id
-- Returns:
-
hasErrorsForInputHint
Checks if thisValidationResult
containsValidationError's
with the giveninputHint
.This can be used to test if there are
ValidationError's
for a specified attribute or attribute path.- Parameters:
inputHint
-- Returns:
-
getErrorsForInputHint
Returns aSet
ofValidationError's
with the giveninputHint
if present, otherwise an emptySet
is returned.- Parameters:
inputHint
-- Returns:
-