Class AbstractTask.WithResult<T>

java.lang.Object
org.praxislive.ide.core.api.AbstractTask
org.praxislive.ide.core.api.AbstractTask.WithResult<T>
Type Parameters:
T - result type
All Implemented Interfaces:
org.openide.util.Cancellable, Task, Task.WithResult<T>
Enclosing class:
AbstractTask

public abstract static class AbstractTask.WithResult<T> extends AbstractTask implements Task.WithResult<T>
A base implementation of a task with a result. Extensions of this class should make sure to call complete(java.lang.Object) to set the result and complete the task if successful.
  • Constructor Details

    • WithResult

      public WithResult()
  • Method Details

    • result

      public final T result()
      Description copied from interface: Task.WithResult
      Access the result. This method should only be called when the task is in a completed state. The result in other states is undefined.
      Specified by:
      result in interface Task.WithResult<T>
      Returns:
      completed task result
    • complete

      protected final void complete(T result)
      Complete the task with the given result. The task must be in Task.State.RUNNING. The result will be set and the task put into Task.State.COMPLETED with all listeners called.
      Parameters:
      result - result to complete task