@ProviderType public final class DefaultValidationResult extends java.lang.Object implements ValidationResult, java.io.Serializable
ValidationResult
wrapping a list of ValidationFailure
s.Modifier and Type | Field and Description |
---|---|
static DefaultValidationResult |
VALID
Used to indicated a valid result.
|
Constructor and Description |
---|
DefaultValidationResult(java.lang.String location,
int severity,
java.util.ResourceBundle defaultResourceBundle,
java.lang.String messageKey,
java.lang.Object... messageArguments)
Constructs a result with one failure message.
|
DefaultValidationResult(ValidationFailure... failures) |
DefaultValidationResult(ValidatorContext validationContext,
java.lang.String messageKey,
java.lang.Object... messageArguments)
Constructs a result with one failure message.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<ValidationFailure> |
getFailures()
In case the validation failed (check the
ValidationResult.isValid() method), this method returns the failure's causes. |
boolean |
isValid()
Tells if the validation was successful or not.
|
@Nonnull public static final DefaultValidationResult VALID
public DefaultValidationResult(@Nonnull ValidatorContext validationContext, @Nonnull java.lang.String messageKey, java.lang.Object... messageArguments)
MessageFormat.format(String, Object...)
.validationContext
- the context from which to take the location, severity and default resource bundlemessageKey
- the message key used for looking up a value in the resource bundle given in ValidationFailure.getMessage(java.util.ResourceBundle)
messageArguments
- optional number of arguments being used in MessageFormat.format(String, Object...)
public DefaultValidationResult(@Nonnull java.lang.String location, int severity, @Nonnull java.util.ResourceBundle defaultResourceBundle, @Nonnull java.lang.String messageKey, java.lang.Object... messageArguments)
MessageFormat.format(String, Object...)
.location
- the locationseverity
- the severity of the embedded failure (may be null
which leads to using the validator's default severity)defaultResourceBundle
- the default resourceBundle which is used to resolve the messageKey
if no other bundle is providedmessageKey
- the message key used for looking up a value in the resource bundle given in ValidationFailure.getMessage(java.util.ResourceBundle)
messageArguments
- optional number of arguments being used in MessageFormat.format(String, Object...)
public DefaultValidationResult(ValidationFailure... failures)
public boolean isValid()
ValidationResult
isValid
in interface ValidationResult
true
for yes, false
otherwise@Nonnull public java.util.List<ValidationFailure> getFailures()
ValidationResult
ValidationResult.isValid()
method), this method returns the failure's causes.getFailures
in interface ValidationResult
null
)Copyright © 2018 The Apache Software Foundation. All rights reserved.