Interface ProgressToken<T>
public interface ProgressToken<T>
-
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels the progress if it has not finished yet.Gets the already startedCompletionStagewhich completes with the result.booleanIs the progress cancelled or not.onException(Consumer<Throwable> exception) Adds a new consumer to the progressToken which gets called if the the progress fails with an exception.onProgress(Consumer<Double> progress) Adds a new consumer to the progressToken which gets called each time the progress percentage from 0.0(0%) to 1.0 (100%) changes.Adds a new consumer to the progressToken which gets called once the the progress completes.
-
Method Details
-
getCompletionStage
CompletionStage<T> getCompletionStage()Gets the already startedCompletionStagewhich completes with the result. This instance can be used to execute calls after the progress has finished and listens to exceptions thrown during the progress.- Returns:
- NotNull instance of
CompletionStage.
-
onProgress
Adds a new consumer to the progressToken which gets called each time the progress percentage from 0.0(0%) to 1.0 (100%) changes. Is at least called once for 0.0 and once for 1.0.- Parameters:
progress-Consumer.- Returns:
- This instance.
-
onException
Adds a new consumer to the progressToken which gets called if the the progress fails with an exception.- Parameters:
exception-Consumer.- Returns:
- This instance.
-
onResult
Adds a new consumer to the progressToken which gets called once the the progress completes.- Parameters:
result-Consumer.- Returns:
- This instance.
-
isCancelled
boolean isCancelled()Is the progress cancelled or not.- Returns:
- True if cancelled. False if not.
-
cancel
void cancel()Cancels the progress if it has not finished yet.
-