Package com.vaadin.signals.operations
Class SignalOperation<T>
java.lang.Object
com.vaadin.signals.operations.SignalOperation<T>
- Type Parameters:
T- the result type
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CancelableOperation,InsertOperation,TransactionOperation
An operation triggered on a signal instance. The result will be populated
when the operation has been confirmed. The type of the result depends on the
operation type.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA failed signal operation result.static final recordA successful signal operation result.static interfaceThe result of a signal operation. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new signal operation that will get a result later.SignalOperation(SignalOperation.ResultOrError<T> resultOrError) Creates a new signal operation that already has a result. -
Method Summary
Modifier and TypeMethodDescriptionprotected <R> voidforwardMappedResult(SignalOperation<R> target, SerializableFunction<T, R> mapper) Forwards the result of this operation to another operation after applying the mapper function.<R> SignalOperation<R> map(SerializableFunction<T, R> mapper) Creates a new operation that transforms the result value using the given mapper function.result()Gets the eventual operation result.
-
Constructor Details
-
SignalOperation
public SignalOperation()Creates a new signal operation that will get a result later. -
SignalOperation
Creates a new signal operation that already has a result.- Parameters:
resultOrError- the result of the operation, notnull
-
-
Method Details
-
result
Gets the eventual operation result.- Returns:
- a completable future with the operation result, not
null
-
map
Creates a new operation that transforms the result value using the given mapper function. If this operation fails, the mapped operation will also fail with the same error.- Type Parameters:
R- the mapped result type- Parameters:
mapper- the function to transform the result value, notnull- Returns:
- a new operation with the mapped result, not
null
-
forwardMappedResult
Forwards the result of this operation to another operation after applying the mapper function. If this operation fails, the target operation will also fail with the same error.- Type Parameters:
R- the mapped result type- Parameters:
target- the operation to forward the result to, notnullmapper- the function to transform the result value, notnull
-