chibenwa commented on code in PR #2991:
URL: https://github.com/apache/james-project/pull/2991#discussion_r3049286894
##########
event-bus/api/src/main/java/org/apache/james/events/DeserializationResult.java:
##########
@@ -19,14 +19,22 @@
package org.apache.james.events;
+import java.util.List;
import java.util.Optional;
-public interface DeserializationResult {
+public sealed interface DeserializationResult permits
DeserializationResult.Success, DeserializationResult.Failure {
static DeserializationResult of(Optional<Event> maybeEvent, String
throwingMessage) {
return maybeEvent.<DeserializationResult>map(Success::new)
.orElse(new Failure(throwingMessage));
}
+ static List<DeserializationResult> reduce(List<DeserializationResult>
firstList, List<DeserializationResult> secondList) {
+ if (!firstList.isEmpty() && firstList.getFirst().isSuccess()) {
+ return firstList;
+ }
+ return secondList;
+ }
Review Comment:
This raises questions.
Reduce is a standard operation collapsing a collection of lemtns into a
sinpgle element protentially of a different type.
Signatures do not match...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]