public class SimpleMergeValidationResult extends Object implements MergeValidationResult
| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleMergeValidationResult.Builder |
| Constructor and Description |
|---|
SimpleMergeValidationResult(SimpleMergeValidationResult.Builder builder) |
| Modifier and Type | Method and Description |
|---|---|
static SimpleMergeValidationResult.Builder |
builder(ValidationResult result) |
ServiceException |
convertToServiceException(String errorMsg)
Converts this validation result into a
ServiceException without throwing. |
Iterable<ValidationError> |
getErrors()
Returns an iterable of the errors (if any) stored in this result.
|
boolean |
isAuthorized()
Checks for authorization status.
|
boolean |
isValid()
Checks for validity.
|
ServiceException |
throwIfInvalid()
Deprecated.
since 5.10 please use
throwIfNotSuccessful() |
ServiceException |
throwIfInvalid(String msg)
Deprecated.
since 5.10 please use
throwIfNotSuccessful(String) |
void |
throwIfNotSuccessful()
Converts this validation result into a
ServiceException and throws it. |
void |
throwIfNotSuccessful(String msg)
Converts this validation result into a
ServiceException and throws it. |
void |
throwIfNotValid(String msg)
Deprecated.
since 5.10 please use
throwIfNotSuccessful(String) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisNotSuccessful, isSuccessfulpublic SimpleMergeValidationResult(SimpleMergeValidationResult.Builder builder)
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 isValid()
ValidationResultauthorization check.
By contract implementations MUST return false if there are errors in this ValidationResult.
Default implementation is usually enough.
isValid in interface ValidationResulttrue if there are no errors in this result, false otherwise.ValidationResult.getErrors(),
ValidationResult.isAuthorized(),
ValidationResult.isSuccessful()public Iterable<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(),
ValidationError@Deprecated public ServiceException throwIfInvalid(String msg) throws ServiceException
throwIfNotSuccessful(String)ValidationResultServiceException and throws it.
Checks for both: ValidationResult.isValid() and ValidationResult.isAuthorized().
Issues:
This method is deprecated since 5.10, please use ValidationResult.throwIfNotSuccessful(String)
throwIfInvalid in interface ValidationResultServiceExceptionValidationResult.throwIfNotSuccessful(String)@Deprecated public void throwIfNotValid(String msg) throws ServiceException
throwIfNotSuccessful(String)ValidationResultServiceException and throws it.
Checks for both: ValidationResult.isValid() and ValidationResult.isAuthorized().
Issues:
This method is deprecated since 5.10, please use ValidationResult.throwIfNotSuccessful(String)
throwIfNotValid in interface ValidationResultServiceExceptionValidationResult.throwIfNotSuccessful(String)@Deprecated public ServiceException throwIfInvalid() throws ServiceException
throwIfNotSuccessful()ValidationResultFirst validation error will be used as message string
This method is deprecated since 5.10, please use ValidationResult.throwIfNotSuccessful()
throwIfInvalid in interface ValidationResultServiceExceptionValidationResult.throwIfNotSuccessful()public void throwIfNotSuccessful(String msg) throws ServiceException
ValidationResultServiceException and throws it.
By default provided string will be used as an exception message.
By contract implementations MUST throw proper subclass of ServiceException when ValidationResult.isNotSuccessful().
throwIfNotSuccessful in interface ValidationResultServiceExceptionValidationResult.isNotSuccessful(),
ValidationResult.convertToServiceException(String)public void throwIfNotSuccessful()
throws ServiceException
ValidationResultServiceException and throws it.
By default first validation error (if any) will be used as an exception message.
By contract implementations MUST throw proper subclass of ServiceException when ValidationResult.isNotSuccessful().
throwIfNotSuccessful in interface ValidationResultServiceExceptionValidationResult.isNotSuccessful(),
ValidationResult.convertToServiceException(String),
ValidationResult.getErrors(),
ValidationErrorpublic ServiceException convertToServiceException(@Nullable 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 SimpleMergeValidationResult.Builder builder(ValidationResult result)
Copyright © 2003–2017 Atlassian. All rights reserved.