Package com.atlassian.bitbucket.util
Interface CancelState
- All Known Subinterfaces:
CancelableEvent
,PermissionGrantRequestedEvent
,PermissionModificationRequestedEvent
,PermissionRevocationRequestedEvent
- All Known Implementing Classes:
AttachmentDeletionRequestedEvent
,AttachmentSaveRequestedEvent
,CommitDiscussionCancelableCommentEvent
,CommitDiscussionCommentAddRequestedEvent
,CommitDiscussionCommentDeletionRequestedEvent
,CommitDiscussionCommentModificationRequestedEvent
,CommitDiscussionCommentReplyRequestedEvent
,GlobalPermissionGrantRequestedEvent
,GlobalPermissionModificationRequestedEvent
,GlobalPermissionRevocationRequestedEvent
,ProjectCreationRequestedEvent
,ProjectDeletionRequestedEvent
,ProjectModificationRequestedEvent
,ProjectPermissionGrantRequestedEvent
,ProjectPermissionModificationRequestedEvent
,ProjectPermissionRevocationRequestedEvent
,PullRequestCancelableCommentEvent
,PullRequestCommentAddRequestedEvent
,PullRequestCommentDeletionRequestedEvent
,PullRequestCommentModificationRequestedEvent
,PullRequestCommentReplyRequestedEvent
,PullRequestDeletionRequestedEvent
,PullRequestOpenRequestedEvent
,RepositoryCreationRequestedEvent
,RepositoryDeletionRequestedEvent
,RepositoryForkRequestedEvent
,RepositoryModificationRequestedEvent
,RepositoryPermissionGrantRequestedEvent
,RepositoryPermissionModificationRequestedEvent
,RepositoryPermissionRevocationRequestedEvent
public interface CancelState
Tracks the cancellation state of a cancelable operation.
Once an operation has been canceled
, it cannot be "un-canceled". Where multiple
observers have the option to cancel an operation, cancellation by any observer should be considered as
final and binding; implementations should not require consensus among all observers.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel
(KeyedMessage message) Cancels the operation, providing a message explaining why.boolean
Retrieves a flag indicating whether the operation has been canceled.
-
Method Details
-
cancel
Cancels the operation, providing a message explaining why.The cancellation message is required, and should be as descriptive and clear as possible to allow end users to correct, if possible, the issue that triggered cancellation.
- Parameters:
message
- a descriptive message explaining why the operation has been canceled- Throws:
NullPointerException
- if the providedmessage
isnull
-
isCanceled
boolean isCanceled()Retrieves a flag indicating whether the operation has been canceled.In situations where multiple observers have the option to cancel an operation, for example when multiple listeners receive the same
CancelableEvent
, this flag can be useful for determining that another observer has already canceled the operation.- Returns:
true
if the operation has beencanceled
; otherwise,false
-