Skip to content

Commit

Permalink
fix: use default implementation for Command/Reply adapters declaration
Browse files Browse the repository at this point in the history
Controllers may not need adapters for Command/Reply. Using a default
implementation in the interface simplifies the DX by avoiding to
implement those methods.
  • Loading branch information
jgiovaresco committed Mar 26, 2024
1 parent 7c8a146 commit 6b56b3a
Showing 1 changed file with 10 additions and 6 deletions.
Expand Up @@ -40,19 +40,23 @@ public interface ControllerCommandHandlersFactory {
* @param controllerCommandContext the command context
* @return a list of command decorators
*/
List<CommandAdapter<? extends Command<?>, ? extends Command<?>, ? extends Reply<?>>> buildCommandAdapters(
default List<CommandAdapter<? extends Command<?>, ? extends Command<?>, ? extends Reply<?>>> buildCommandAdapters(
final ControllerCommandContext controllerCommandContext,
final ProtocolVersion protocolVersion
);
) {
return List.of();
}

/**
* Build a list of command decorators dedicated to the specified context.
* Build a list of reply decorators dedicated to the specified context.
*
* @param controllerCommandContext the command context
* @return a list of command decorators
* @return a list of reply decorators
*/
List<ReplyAdapter<? extends Reply<?>, ? extends Reply<?>>> buildReplyAdapters(
default List<ReplyAdapter<? extends Reply<?>, ? extends Reply<?>>> buildReplyAdapters(
final ControllerCommandContext controllerCommandContext,
final ProtocolVersion protocolVersion
);
) {
return List.of();
}
}

0 comments on commit 6b56b3a

Please sign in to comment.