public class SimpleValidationResult extends Object implements ValidationResult
| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleValidationResult.Builder |
| Modifier and Type | Field and Description |
|---|---|
static ValidationResult |
FORBIDDEN
A singleton unauthorized result.
|
static ValidationResult |
VALID
A singleton valid result.
|
| Modifier and Type | Method and Description |
|---|---|
static SimpleValidationResult.Builder |
builder() |
ServiceException |
convertToServiceException(String errorMsg)
Converts this validation result into a
ServiceException without throwing. |
Collection<ValidationError> |
getErrors()
Returns an iterable of the errors (if any) stored in this result.
|
boolean |
isAuthorized()
Checks for authorization status.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisNotSuccessful, isSuccessful, isValid, throwIfInvalid, throwIfInvalid, throwIfNotSuccessful, throwIfNotSuccessful, throwIfNotValidpublic static final ValidationResult VALID
public static final ValidationResult FORBIDDEN
public boolean isAuthorized()
ValidationResultvalidity check.isAuthorized in interface ValidationResulttrue if the current user is permitted to perform the execution that the validation is for, false otherwise.ValidationResult.isValid(),
ValidationResult.isSuccessful()public Collection<ValidationError> getErrors()
ValidationResultValidationResult.isValid() returning false.
Default implementation of ValidationResult.isValid() is safe for null values.
Be cautious about returning null if not using the default implementation for ValidationResult.isValid().
getErrors in interface ValidationResultValidationResult.isValid(),
ValidationErrorpublic ServiceException convertToServiceException(String errorMsg)
ValidationResultServiceException without throwing.
Implementations of this method should reasonably analyze the internals of this ValidationResult
and return appropriate subclass of ServiceException which is most suitable for the case.
This method is used internally in the default implementations of ValidationResult.throwIfNotSuccessful() and ValidationResult.throwIfNotSuccessful(String)
convertToServiceException in interface ValidationResulterrorMsg - message to put in the Exception returnedServiceException subclass.ValidationResult.throwIfNotSuccessful(),
ValidationResult.throwIfNotSuccessful(String)public static SimpleValidationResult.Builder builder()
Copyright © 2003–2017 Atlassian. All rights reserved.