Interface EventConverter
- All Superinterfaces:
Converter,DescribableComponent
- All Known Implementing Classes:
DelegatingEventConverter
A converter specific for
EventMessages, acting on the payload.
This interface serves the purpose of enforcing use of the right type of converter. Implementation of this interface
typically delegate operations to a MessageConverter instance, unless the serialized format of events and other messages differ.
- Since:
- 5.0.0
- Author:
- Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptiondefault <E extends EventMessage,T>
EconvertEvent(E event, Class<T> targetType) Converts the givenevent'spayloadto the giventargetType, returning a newEventMessagewith the converted payload.<E extends EventMessage>
EconvertEvent(E event, Type targetType) Converts the givenevent'spayloadto the giventargetType, returning a newEventMessagewith the converted payload.default <E extends EventMessage,T>
TconvertPayload(E event, Class<T> targetType) <E extends EventMessage,T>
TconvertPayload(E event, Type targetType) Methods inherited from interface org.axonframework.conversion.Converter
canConvert, canConvert, convert, convertMethods inherited from interface org.axonframework.common.infra.DescribableComponent
describeTo
-
Method Details
-
convertPayload
@Nullable default <E extends EventMessage,T> T convertPayload(@Nonnull E event, @Nonnull Class<T> targetType) - Type Parameters:
E- The type ofEventMessageto convert the payload for.T- The target data type.- Parameters:
event- TheEventMessageto convert thepayloadfor.targetType- The type to convert thepayloadinto.- Returns:
- A converted version of the given
EventMessage'spayloadinto the giventargetType.
-
convertPayload
- Type Parameters:
E- The type ofEventMessageto convert the payload for.T- The target data type.- Parameters:
event- TheEventMessageto convert thepayloadfor.targetType- The type to convert thepayloadinto.- Returns:
- A converted version of the given
EventMessage'spayloadinto the giventargetType.
-
convertEvent
@Nonnull default <E extends EventMessage,T> E convertEvent(@Nonnull E event, @Nonnull Class<T> targetType) Converts the givenevent'spayloadto the giventargetType, returning a newEventMessagewith the converted payload.- Type Parameters:
E- The type ofEventMessageto convert and return.T- The target data type.- Parameters:
event- TheEventMessageto convert thepayloadfor.targetType- The type to convert thepayloadinto.- Returns:
- A new
EventMessagecontaining the converted version of the givenevent'spayloadinto the giventargetType.
-
convertEvent
Converts the givenevent'spayloadto the giventargetType, returning a newEventMessagewith the converted payload.- Type Parameters:
E- The type ofEventMessageto convert and return.- Parameters:
event- TheEventMessageto convert thepayloadfor.targetType- The type to convert thepayloadinto.- Returns:
- A new
EventMessagecontaining the converted version of the givenevent'spayloadinto the giventargetType.
-