@ProviderType public final class DefaultValidationFailure extends Object implements ValidationFailure, Serializable
ResourceBundle
), messageArguments (being used with MessageFormat.format(String, Object...)
and the location where the validation failure occurred.Constructor and Description |
---|
DefaultValidationFailure(String location,
int severity,
ResourceBundle defaultResourceBundle,
String messageKey,
Object... messageArguments)
Constructor of a validation failure.
|
DefaultValidationFailure(ValidatorContext validationContext,
String messageKey,
Object... messageArguments)
Constructor of a validation failure.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getLocation()
Returns the relative location of the property/resource/value which triggered this validation failure.
|
String |
getMessage(ResourceBundle resourceBundle) |
int |
getSeverity() |
int |
hashCode() |
String |
toString() |
public DefaultValidationFailure(@Nonnull ValidatorContext validationContext, @Nonnull String messageKey, Object... messageArguments)
validationContext
- the context from which to extract location, severity and default resource bundlemessageKey
- the key to look up in the resource bundlemessageArguments
- the arguments to be used with the looked up value from the resource bundle (given in getMessage(ResourceBundle)
public DefaultValidationFailure(@Nonnull String location, int severity, @Nonnull ResourceBundle defaultResourceBundle, @Nonnull String messageKey, Object... messageArguments)
location
- the location where the validation error occurredseverity
- the severity of this failure (may be null
which leads to using the validator's default severity)defaultResourceBundle
- the default resourceBundle which is used to resolve the messageKey
in getMessage(ResourceBundle)
if null
is provided as parameter.messageKey
- the key to look up in the resource bundlemessageArguments
- the arguments to be used with the looked up value from the resource bundle (given in getMessage(ResourceBundle)
@Nonnull public String getMessage(ResourceBundle resourceBundle)
getMessage
in interface ValidationFailure
resourceBundle
- ResourceBundle in which to look up the according message (used for i18n), if null
is given, the default resource bundle is used.@Nonnull public String getLocation()
ValidationFailure
ValidationService.validate(org.apache.sling.api.resource.Resource, org.apache.sling.validation.model.ValidationModel)
or ValidationService.validateResourceRecursively(org.apache.sling.api.resource.Resource, boolean, java.util.function.Predicate, boolean)
orValidationService.validate(org.apache.sling.api.resource.ValueMap, org.apache.sling.validation.model.ValidationModel)
getLocation
in interface ValidationFailure
public int getSeverity()
getSeverity
in interface ValidationFailure
0
.Copyright © 2017 The Apache Software Foundation. All rights reserved.