mirror of
https://github.com/tommyskeff/futur4j.git
synced 2026-01-17 23:16:01 +00:00
26 lines
584 B
Java
26 lines
584 B
Java
package dev.tommyjs.futur.promise;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
/**
|
|
* A {@link Promise} that can be completed.
|
|
*/
|
|
public interface CompletablePromise<T> extends Promise<T> {
|
|
|
|
/**
|
|
* Completes the promise successfully with the given result.
|
|
*
|
|
* @param result the result
|
|
*/
|
|
void complete(@Nullable T result);
|
|
|
|
/**
|
|
* Completes the promise exceptionally with the given exception.
|
|
*
|
|
* @param result the exception
|
|
*/
|
|
void completeExceptionally(@NotNull Throwable result);
|
|
|
|
}
|