Class NoEventUpcaster

java.lang.Object
com.opencqrs.framework.upcaster.NoEventUpcaster
All Implemented Interfaces:
EventUpcaster

public class NoEventUpcaster extends Object implements EventUpcaster
EventUpcaster implementation that drops an Event if the Event.type() matches the configured type.
  • Constructor Details

    • NoEventUpcaster

      public NoEventUpcaster(String type)
  • Method Details

    • canUpcast

      public boolean canUpcast(Event event)
      Description copied from interface: EventUpcaster
      Determines if this upcaster is relevant for upcasting the given Event. This method must be called prior to EventUpcaster.upcast(Event).
      Specified by:
      canUpcast in interface EventUpcaster
      Parameters:
      event - the event that may need to be upcasted
      Returns:
      true if this can upcast the event, false otherwise
    • upcast

      public Stream<EventUpcaster.Result> upcast(Event event)
      Description copied from interface: EventUpcaster
      Upcasts the given event to a stream of EventUpcaster.Results. This allows implementations to:
      • effectively drop an event by returning an empty stream
      • upcast an event to one new event by returning a single element stream
      • effectively split up an event by returning a multi element stream
      Specified by:
      upcast in interface EventUpcaster
      Parameters:
      event - the event to be upcasted
      Returns:
      a stream of EventUpcaster.Results carrying the upcasted Event.type() and Event.data()