public class InitialEventRepresentation extends Object implements IntermediateEventRepresentation
IntermediateEventRepresentation that contains the original serialized payload and
metadata before these have been upcast. Usually there is one InitialEventRepresentation per event entry
from the data store.| Constructor and Description |
|---|
InitialEventRepresentation(EventData<?> eventData,
Serializer serializer)
Initializes an
InitialEventRepresentation from the given eventData. |
| Modifier and Type | Method and Description |
|---|---|
Optional<String> |
getAggregateIdentifier()
Returns the Identifier of the Aggregate to which the Event owning the object to upcast, was applied.
|
Optional<String> |
getAggregateType()
Returns the Type of the Aggregate to which the Event owning the object to upcast, was applied.
|
SerializedObject<?> |
getData()
Get the data of this representation.
|
<D> SerializedObject<D> |
getData(Class<D> requiredType)
Get the data of this representation.
|
String |
getMessageIdentifier()
Returns the identifier of the message wrapping the object to upcast.
|
LazyDeserializingObject<MetaData> |
getMetaData()
Returns the meta data of the message wrapping the object being upcast.
|
Optional<Long> |
getSequenceNumber()
Returns the sequence number of the event in the aggregate, or an empty Optional if the message wrapping the
object being upcast does not contain a sequence number.
|
Instant |
getTimestamp()
Returns the timestamp at which the event was first created.
|
Optional<TrackingToken> |
getTrackingToken()
Returns the tracking token of the event, or an empty Optional if the message wrapping the object being upcast
does not contain a tracking token.
|
SerializedType |
getType()
Returns the type and version of the data contained in this representation.
|
<T> IntermediateEventRepresentation |
upcast(SerializedType outputType,
Class<T> expectedRepresentationType,
Function<T,T> upcastFunction,
Function<MetaData,MetaData> metaDataUpcastFunction)
Upcast the serialized payload of the event (leaving other aspects of the event the same).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitupcastPayloadpublic InitialEventRepresentation(EventData<?> eventData, Serializer serializer)
InitialEventRepresentation from the given eventData. The provided serializer is used to deserialize metadata if the metadata is required during upcasting. The serializer also
provides the Converter used to convert serialized data from one format to another if required
by any upcaster.eventData - the serialized event dataserializer - the serializer to deserialize metadata and provide the converter factorypublic <T> IntermediateEventRepresentation upcast(SerializedType outputType, Class<T> expectedRepresentationType, Function<T,T> upcastFunction, Function<MetaData,MetaData> metaDataUpcastFunction)
IntermediateEventRepresentationupcast in interface IntermediateEventRepresentationT - The expected payload type before and after upcastingoutputType - The output type of the event after upcastingexpectedRepresentationType - The type of the serialized payload required by the upcast functionupcastFunction - The upcast function for the event's payloadmetaDataUpcastFunction - The upcast function for the event's metadatapublic SerializedType getType()
IntermediateEventRepresentationgetType in interface IntermediateEventRepresentationpublic SerializedObject<?> getData()
IntermediateEventRepresentationIntermediateEventRepresentation.getType().getData in interface IntermediateEventRepresentationpublic <D> SerializedObject<D> getData(Class<D> requiredType)
IntermediateEventRepresentationrequiredType.getData in interface IntermediateEventRepresentationrequiredType - the type to convert topublic String getMessageIdentifier()
IntermediateEventRepresentationgetMessageIdentifier in interface IntermediateEventRepresentationpublic Optional<String> getAggregateType()
IntermediateEventRepresentationgetAggregateType in interface IntermediateEventRepresentationpublic Optional<String> getAggregateIdentifier()
IntermediateEventRepresentationgetAggregateIdentifier in interface IntermediateEventRepresentationpublic Optional<Long> getSequenceNumber()
IntermediateEventRepresentationgetSequenceNumber in interface IntermediateEventRepresentationpublic Optional<TrackingToken> getTrackingToken()
IntermediateEventRepresentationgetTrackingToken in interface IntermediateEventRepresentationpublic Instant getTimestamp()
IntermediateEventRepresentationnull if the object being
upcastgetTimestamp in interface IntermediateEventRepresentationpublic LazyDeserializingObject<MetaData> getMetaData()
IntermediateEventRepresentationnull.getMetaData in interface IntermediateEventRepresentationCopyright © 2010–2017. All rights reserved.