Package org.omegat.core.threads
Class Completion
java.lang.Object
org.omegat.core.threads.Completion
Represents the completion status of a task,
including success, cancellation, or failure.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of possible completion statuses. -
Method Summary
Modifier and TypeMethodDescriptionstatic CompletionCreates and returns aCompletioninstance representing a cancelled operation.static CompletionCreates and returns aCompletioninstance representing a failed operation.getCause()Returns the cause of the failure, if any.booleanCheck if status is CANCELLED.booleanisFailed()Check if status is FAILED.booleanCheck if status is SUCCESS.static Completionsuccess()Creates and returns aCompletioninstance representing a successful completion.
-
Method Details
-
isSuccess
public boolean isSuccess()Check if status is SUCCESS.- Returns:
- true if the completion status is SUCCESS, false otherwise
-
isCancelled
public boolean isCancelled()Check if status is CANCELLED.- Returns:
- true if the completion status is CANCELLED, false otherwise
-
isFailed
public boolean isFailed()Check if status is FAILED.- Returns:
- true if the completion status is FAILED, false otherwise
-
getCause
Returns the cause of the failure, if any.- Returns:
- the
Throwabledescribing the cause of failure, or null if the completion was successful or canceled
-
success
Creates and returns aCompletioninstance representing a successful completion.- Returns:
- a
Completionobject with aStatus.SUCCESSstate and no error.
-
cancelled
Creates and returns aCompletioninstance representing a cancelled operation.- Returns:
- a
Completionobject with aStatus.CANCELLEDstate and no associated error.
-
failed
Creates and returns aCompletioninstance representing a failed operation.- Parameters:
error- theThrowabledescribing the cause of failure, may be null- Returns:
- a
Completionobject with aStatus.FAILEDstate and the provided error
-