@ProviderType public final class DefaultValidationResult extends Object implements ValidationResult, 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(String location,
int severity,
ResourceBundle defaultResourceBundle,
String messageKey,
Object... messageArguments)
Constructs a result with one failure message.
|
DefaultValidationResult(ValidationFailure... failures) |
DefaultValidationResult(ValidatorContext validationContext,
String messageKey,
Object... messageArguments)
Constructs a result with one failure message.
|
Modifier and Type | Method and Description |
---|---|
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 String messageKey, 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 String location, int severity, @Nonnull ResourceBundle defaultResourceBundle, @Nonnull String messageKey, 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 List<ValidationFailure> getFailures()
ValidationResult
ValidationResult.isValid()
method), this method returns the failure's causes.getFailures
in interface ValidationResult
null
)Copyright © 2017 The Apache Software Foundation. All rights reserved.