T
- The type of the result of this Operation
Operation<T>
, OutOperation<T>
, ParameterizedOperation<T>
, PrimitiveOperation<T>
public interface MultiOperation<T> extends OutOperation<T>
Operation
that returns one or more results in
addition to the out result defined by the Operation
. Each result is
processed by an Operation. The Operations can be created by calling
rowOperation, rowProcessorOperation, or countOperation if the kind of results
is known. These results are processed in the order the Operations are
submitted. Any results not processed by an explicit Operation is processed by
calling the appropriate handler specified by onRows or onCount. If any result
is an error that error is processed by calling the handler specified by
onError. If the appropriate handler is not specified that result is ignored,
including errors.
ISSUE: Should this have a collector?Modifier and Type | Method | Description |
---|---|---|
MultiOperation<T> |
apply(java.util.function.Function<Result.OutColumn,? extends T> processor) |
Provide a processor that will handle the result of executing the SQL.
|
MultiOperation<T> |
onCount(java.util.function.BiConsumer<java.lang.Integer,RowCountOperation<T>> handler) |
Provides a handler for trailing count results.
|
MultiOperation<T> |
onError(java.util.function.BiConsumer<java.lang.Integer,java.lang.Throwable> handler) |
Provides an error handler for this
Operation . |
MultiOperation<T> |
onError(java.util.function.Consumer<java.lang.Throwable> handler) |
This handler is called if the execution fails completely.
|
MultiOperation<T> |
onRows(java.util.function.BiConsumer<java.lang.Integer,RowOperation<T>> handler) |
Provides a handler for trailing row sequence results.
|
MultiOperation<T> |
outParameter(java.lang.String id,
SqlType type) |
Register an out parameter identified by the given id.
|
RowCountOperation<T> |
rowCountOperation() |
Returns a
RowCountOperation to process a count result. |
RowOperation<T> |
rowOperation() |
Returns a
RowOperation to process a row sequence result. |
RowPublisherOperation<T> |
rowProcessorOperation() |
Returns a
RowPublisherOperation to process a row sequence result. |
MultiOperation<T> |
set(java.lang.String id,
java.lang.Object value) |
Set a parameter value.
|
MultiOperation<T> |
set(java.lang.String id,
java.lang.Object value,
SqlType type) |
Set a parameter value.
|
MultiOperation<T> |
set(java.lang.String id,
java.util.concurrent.CompletionStage<?> source) |
Set a parameter value to be the future value of a
CompletionStage . |
MultiOperation<T> |
set(java.lang.String id,
java.util.concurrent.CompletionStage<?> source,
SqlType type) |
Set a parameter value to be the value of a
CompletionStage . |
MultiOperation<T> |
timeout(java.time.Duration minTime) |
The minimum time before this
Operation might be canceled
automatically. |
submit
RowOperation<T> rowOperation()
RowOperation
to process a row sequence result. The
Operation
s are executed in the order they are submitted. If a
result is of the wrong type for the next submitted Operation
the
MultiOperation
is completed with IllegalStateException
.RowOperation
that is part of this MultiOperation
RowPublisherOperation<T> rowProcessorOperation()
RowPublisherOperation
to process a row sequence result.
The Operation
s are executed in the order they are submitted. If a
result is of the wrong type for the next submitted Operation
the
MultiOperation
is completed with IllegalStateException
.RowPublisherOperation
that is part of this
MultiOperation
RowCountOperation<T> rowCountOperation()
RowCountOperation
to process a count result. The
Operation
s are executed in the order they are submitted. If a
result is of the wrong type for the next submitted Operation the
MultiOperation
is completed with IllegalStateException
.RowCountOperation
that is part of this
MultiOperation
MultiOperation<T> onCount(java.util.function.BiConsumer<java.lang.Integer,RowCountOperation<T>> handler)
RowCountOperation
that
will process the current result. This RowCountOperation
has not
been configured in any way nor has it been submitted. The handler
configures the RowCountOperation
and submits it. The count result
is processed when the RowCountOperation
is submitted. If the
RowCountOperation
is not submitted when the handler returns the
count result is ignored.
If this method is not called any trailing count results are ignored.handler
- not nulljava.lang.IllegalStateException
- if this method was called previouslyMultiOperation<T> onRows(java.util.function.BiConsumer<java.lang.Integer,RowOperation<T>> handler)
RowOperation
that will
process the current result. This RowOperation
has not been
configured in any way nor has it been submitted. The handler configures the
RowOperation
and submits it. The row sequence result is processed
when the RowOperation
is submitted. If the RowOperation
is
not submitted when the handler returns, the row sequence result is ignored.
If this method is not called any trailing row sequence results are ignored.
ISSUE: Should there be a version of this method that provides
RowProcessorOperations? If so only one of that method or this one can be
called.handler
- java.lang.IllegalStateException
- if this method was called previouslyMultiOperation<T> onError(java.util.function.BiConsumer<java.lang.Integer,java.lang.Throwable> handler)
Operation
. The provided handler
is called for each error that occurs. When called the first argument is the
number of results, including errors, that preceeded the current error. The
second argument is a Throwable
corresponding to the error. When the
handler returns processing of the MultiOperation results continues. Only
one onError method may be called.handler
- a BiConsumer that handles an errorjava.lang.IllegalStateException
- if this method or
onError(java.util.function.Consumer)
was called
previouslyMultiOperation<T> onError(java.util.function.Consumer<java.lang.Throwable> handler)
MultiOperation<T> apply(java.util.function.Function<Result.OutColumn,? extends T> processor)
OutOperation
apply
in interface OutOperation<T>
processor
- the Function
that will be called to process the result of
this OutOperation
OutOperation
MultiOperation<T> outParameter(java.lang.String id, SqlType type)
OutOperation
outParameter
in interface OutOperation<T>
id
- the parameter identifiertype
- the SQL type of the value of the parameterOutOperation
MultiOperation<T> set(java.lang.String id, java.lang.Object value, SqlType type)
ParameterizedOperation
Operation
is completed.set
in interface OutOperation<T>
set
in interface ParameterizedOperation<T>
id
- the identifier of the parameter marker to be setvalue
- the value the parameter is to be set totype
- the SQL type of the value to send to the databaseMultiOperation<T> set(java.lang.String id, java.lang.Object value)
ParameterizedOperation
Operation
is completed.set
in interface OutOperation<T>
set
in interface ParameterizedOperation<T>
id
- the identifier of the parameter marker to be setvalue
- the value the parameter is to be set toOperation
MultiOperation<T> set(java.lang.String id, java.util.concurrent.CompletionStage<?> source, SqlType type)
ParameterizedOperation
CompletionStage
. The Operation
will
not be executed until the CompletionStage
is
completed. This method allows submitting Operation
s that depend on
the result of previous Operation
s rather than requiring that the
dependent Operation
be submitted only when the previous
Operation
completes.set
in interface OutOperation<T>
set
in interface ParameterizedOperation<T>
id
- the identifier of the parameter marker to be setsource
- the CompletionStage
that provides
the value the parameter is to be set totype
- the SQL type of the value to send to the databaseOperation
MultiOperation<T> set(java.lang.String id, java.util.concurrent.CompletionStage<?> source)
ParameterizedOperation
CompletionStage
. The Operation
will
not be executed until the CompletionStage
is
completed. This method allows submitting Operation
s that depend on
the result of previous Operation
s rather than requiring that the
dependent Operation
be submitted only when the previous
Operation
completes. Use a default SQL type determined by the type
of the value of the CompletionStage
argument.set
in interface OutOperation<T>
set
in interface ParameterizedOperation<T>
id
- the identifier of the parameter marker to be setsource
- the CompletionStage
that
provides the value the parameter is to be set toOperation
MultiOperation<T> timeout(java.time.Duration minTime)
Operation
Operation
might be canceled
automatically. The default value is forever. The time is
counted from the beginning of Operation execution. The Operation will not
be canceled before minTime
after the beginning of execution.
Some time at least minTime
after the beginning of execution,
an attempt will be made to cancel the Operation
if it has not yet
completed. Implementations are encouraged to attempt to cancel within a
reasonable time, though what is reasonable is implementation dependent.Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2017, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.
DRAFT JDBC 4.4 EA5