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, wait
isNotSuccessful, isSuccessful, isValid, throwIfInvalid, throwIfInvalid, throwIfNotSuccessful, throwIfNotSuccessful, throwIfNotValid
public static final ValidationResult VALID
public static final ValidationResult FORBIDDEN
public static final ValidationResult NOT_ALLOWED_IN_READ_ONLY_MODE
public boolean isAuthorized()
ValidationResult
validity check
.isAuthorized
in interface ValidationResult
true
if the current user is permitted to perform the execution that the validation is for, false
otherwise.ValidationResult.isValid()
,
ValidationResult.isSuccessful()
public boolean isAllowedInReadOnlyMode()
ValidationResult
validity check
.isAllowedInReadOnlyMode
in interface ValidationResult
true
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()
ValidationResult
ValidationResult.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 ValidationResult
ValidationResult.isValid()
,
ValidationError
public ServiceException convertToServiceException(String errorMsg)
ValidationResult
ServiceException
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 ValidationResult
errorMsg
- message to put in the Exception returnedServiceException
subclass.ValidationResult.throwIfNotSuccessful()
,
ValidationResult.throwIfNotSuccessful(String)
public static SimpleValidationResult.Builder builder()
Copyright © 2003–2020 Atlassian. All rights reserved.