Package org.keycloak.validate
Class ValidationResult
java.lang.Object
org.keycloak.validate.ValidationResult
Denotes the result of a validation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ValidationResultAn empty ValidationResult that's valid by default. -
Constructor Summary
ConstructorsConstructorDescriptionValidationResult(Set<ValidationError> errors) Creates a newValidationResultfrom the given errors. -
Method Summary
Modifier and TypeMethodDescriptionvoidforEachError(Consumer<ValidationError> consumer) Convenience method that accepts aConsumer<ValidationError>.getErrorsForInputHint(String inputHint) Returns aSetofValidationError'swith the giveninputHintif present, otherwise an emptySetis returned.Returns aSetofValidationError'sfrom theValidatorwith the givenidif present, otherwise an emptySetis returned.booleanhasErrorsForInputHint(String inputHint) booleanvoidifNotValidAccept(Consumer<ValidationResult> consumer) Convenience method that accepts aConsumer<ValidationResult>if the result is not valid.booleanisValid()static ValidationResultof(Set<ValidationError> errors) static ValidationResultof(ValidationError... errors)
-
Field Details
-
OK
An empty ValidationResult that's valid by default.
-
-
Constructor Details
-
ValidationResult
Creates a newValidationResultfrom the given errors.The created
ValidationResultis considered valid if the givenerrorsare empty.- Parameters:
errors-
-
-
Method Details
-
of
-
of
-
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 aSetofValidationError'sfrom theValidatorwith the givenidif present, otherwise an emptySetis returned.- Parameters:
id-- Returns:
-
hasErrorsForInputHint
Checks if thisValidationResultcontainsValidationError'swith the giveninputHint.This can be used to test if there are
ValidationError'sfor a specified attribute or attribute path.- Parameters:
inputHint-- Returns:
-
getErrorsForInputHint
Returns aSetofValidationError'swith the giveninputHintif present, otherwise an emptySetis returned.- Parameters:
inputHint-- Returns:
-