Class StatementCompletionStage<T>
- java.lang.Object
-
- com.mrivanplays.sqlhelper.statement.executement.StatementCompletionStage<T>
-
- Type Parameters:
T
- held value type
public final class StatementCompletionStage<T> extends Object
Represents a statement completion stage.
-
-
Constructor Summary
Constructors Constructor Description StatementCompletionStage(ThrowableHolder.ThrowableCallable<T> callable, Executor async)
StatementCompletionStage(ThrowableHolder.ThrowableRunnable runnable, Executor async)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
async()
Executes the completion stage asynchronously without providing a callback.void
async(Consumer<T> onSuccess)
Executes the completion stage asynchronously if async executor is presentvoid
async(Consumer<T> onSuccess, Consumer<Throwable> onError)
Executes the completion stage asynchronously if async executor is present, also providing you with onError consumer.void
complete(BiConsumer<T,Throwable> consumer)
Completes the statement synchronously, providing you with a combined callback for error and value.void
completeAsync(BiConsumer<T,Throwable> consumer)
Completes the statement asynchronously, providing you with a combined callback for error and value.T
sync()
Executes the completion stage synchronouslyT
sync(Function<Throwable,T> onError)
Executes the completion stage synchronously, providing callback to onError
-
-
-
Constructor Detail
-
StatementCompletionStage
public StatementCompletionStage(ThrowableHolder.ThrowableCallable<T> callable, Executor async)
-
StatementCompletionStage
public StatementCompletionStage(ThrowableHolder.ThrowableRunnable runnable, Executor async)
-
-
Method Detail
-
sync
public T sync()
Executes the completion stage synchronously- Returns:
- held value type
-
sync
public T sync(Function<Throwable,T> onError)
Executes the completion stage synchronously, providing callback to onError- Parameters:
onError
- on error- Returns:
- held value type, or if exception, the value returned from onError
-
async
public void async()
Executes the completion stage asynchronously without providing a callback.
-
async
public void async(Consumer<T> onSuccess)
Executes the completion stage asynchronously if async executor is present- Parameters:
onSuccess
- on success callback
-
async
public void async(Consumer<T> onSuccess, Consumer<Throwable> onError)
Executes the completion stage asynchronously if async executor is present, also providing you with onError consumer.- Parameters:
onSuccess
- on success callbackonError
- on error callback
-
complete
public void complete(BiConsumer<T,Throwable> consumer)
Completes the statement synchronously, providing you with a combined callback for error and value.- Parameters:
consumer
- callback
-
completeAsync
public void completeAsync(BiConsumer<T,Throwable> consumer)
Completes the statement asynchronously, providing you with a combined callback for error and value.- Parameters:
consumer
- callback
-
-