Package com.opencqrs.framework.upcaster
Class AbstractEventDataMarshallingEventUpcaster
java.lang.Object
com.opencqrs.framework.upcaster.AbstractEventDataMarshallingEventUpcaster
- All Implemented Interfaces:
EventUpcaster
public abstract class AbstractEventDataMarshallingEventUpcaster
extends Object
implements EventUpcaster
Template implementation of
EventUpcaster that uses a delegate EventDataMarshaller to allow subclasses
to upcast EventData.metaData() and EventData.payload() as pre-extracted JSON-like Maps.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordCaptures upcastedEvent.type(), meta-data, and payload.Nested classes/interfaces inherited from interface com.opencqrs.framework.upcaster.EventUpcaster
EventUpcaster.Result -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractEventDataMarshallingEventUpcaster(EventDataMarshaller eventDataMarshaller) Constructor for implementations ofthis. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Stream<AbstractEventDataMarshallingEventUpcaster.MetaDataAndPayloadResult> Template method to be implemented by subclasses to upcast the given meta-data and payload.final Stream<EventUpcaster.Result> Upcasts the given event to a stream ofEventUpcaster.Results.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.opencqrs.framework.upcaster.EventUpcaster
canUpcast
-
Constructor Details
-
AbstractEventDataMarshallingEventUpcaster
Constructor for implementations ofthis.- Parameters:
eventDataMarshaller- the marshaller used to extractEventDatafromEvent.data()
-
-
Method Details
-
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()
-
doUpcast
protected abstract Stream<AbstractEventDataMarshallingEventUpcaster.MetaDataAndPayloadResult> doUpcast(Event event, Map<String, ?> metaData, Map<String, ?> payload) Template method to be implemented by subclasses to upcast the given meta-data and payload.- Parameters:
event- the event from which meta-data and payload have been extractedmetaData- the meta-datapayload- the payload as JSON-like map- Returns:
- a stream of
AbstractEventDataMarshallingEventUpcaster.MetaDataAndPayloadResultcarrying the upcasted representations - See Also:
-