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 |
NOT_ALLOWED_IN_READ_ONLY_MODE
A singleton notAllowedInReadOnlyMode 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 |
isAllowedInReadOnlyMode()
Checks for allowedInReadOnlyMode status.
|
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 static final ValidationResult NOT_ALLOWED_IN_READ_ONLY_MODE
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 boolean isAllowedInReadOnlyMode()
ValidationResultvalidity check.isAllowedInReadOnlyMode in interface ValidationResulttrue if the current user is allowed to perform the execution in read-only mode 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–2023 Atlassian. All rights reserved.