Class Completion

java.lang.Object
org.omegat.core.threads.Completion

public final class Completion extends Object
Represents the completion status of a task, including success, cancellation, or failure.
  • 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

      public Throwable getCause()
      Returns the cause of the failure, if any.
      Returns:
      the Throwable describing the cause of failure, or null if the completion was successful or canceled
    • success

      public static Completion success()
      Creates and returns a Completion instance representing a successful completion.
      Returns:
      a Completion object with a Status.SUCCESS state and no error.
    • cancelled

      public static Completion cancelled()
      Creates and returns a Completion instance representing a cancelled operation.
      Returns:
      a Completion object with a Status.CANCELLED state and no associated error.
    • failed

      public static Completion failed(Throwable error)
      Creates and returns a Completion instance representing a failed operation.
      Parameters:
      error - the Throwable describing the cause of failure, may be null
      Returns:
      a Completion object with a Status.FAILED state and the provided error