Package com.opencqrs.framework.upcaster
Class TypeChangingEventUpcaster
java.lang.Object
com.opencqrs.framework.upcaster.TypeChangingEventUpcaster
- All Implemented Interfaces:
EventUpcaster
EventUpcaster implementation that changes the Event.type() to a new type if it matches the configured
source type.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.opencqrs.framework.upcaster.EventUpcaster
EventUpcaster.Result -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines ifthisupcaster is relevant for upcasting the givenEvent.Upcasts the given event to a stream ofEventUpcaster.Results.
-
Constructor Details
-
TypeChangingEventUpcaster
-
-
Method Details
-
canUpcast
Description copied from interface:EventUpcasterDetermines ifthisupcaster is relevant for upcasting the givenEvent. This method must be called prior toEventUpcaster.upcast(Event).- Specified by:
canUpcastin interfaceEventUpcaster- Parameters:
event- the event that may need to be upcasted- Returns:
trueifthiscan upcast the event,falseotherwise
-
upcast
Description copied from interface:EventUpcasterUpcasts the given event to a stream ofEventUpcaster.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:
upcastin interfaceEventUpcaster- Parameters:
event- the event to be upcasted- Returns:
- a stream of
EventUpcaster.Results carrying the upcastedEvent.type()andEvent.data()
-