Class CommandConversion

java.lang.Object
org.occurrent.application.composition.command.CommandConversion

public class CommandConversion extends Object
Utility functions to convert functions expecting a list of domain events into a functions expecting a stream of domain events, and vice versa.
  • Constructor Details

    • CommandConversion

      public CommandConversion()
  • Method Details

    • toListCommand

      public static <T> Function<List<T>,List<T>> toListCommand(Function<Stream<T>,Stream<T>> command)
      Convert a command taking Stream<T> into one that takes a List<T>.
      Type Parameters:
      T - The type of the domain event
      Parameters:
      command - The command to convert
      Returns:
      A function that does the conversion described above.
    • toStreamCommand

      public static <T> Function<Stream<T>,Stream<T>> toStreamCommand(Function<List<T>,List<T>> command)
      Convert a command taking List<T> into one that takes a Stream<T>.
      Type Parameters:
      T - The type of the domain event
      Parameters:
      command - The command to convert
      Returns:
      A function that does the conversion described above.