Class PayloadBasedTagResolver<P>
java.lang.Object
org.axonframework.eventsourcing.eventstore.PayloadBasedTagResolver<P>
- All Implemented Interfaces:
TagResolver
Simple implementation of the
TagResolver that is able to combine several lambdas to construct
Tags from payloads of type P.
The results of invoking all configured lambdas are combined into the Set of Tags when invoking
resolve(EventMessage). The resolve operation defaults to return an empty
Set when an EventMessage for another payload type is passed.
- Since:
- 5.0.0
- Author:
- Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptionstatic <P> PayloadBasedTagResolver<P> forPayloadType(Class<P> payloadType) Construct aSimpleTagResolverfor the givenpayloadType.resolve(EventMessage event) Construct a copy ofthis SimpleTagResolver, combining the givenkeyResolverandvalueResolverinto a lambda constructing aTag.withResolver(Function<P, Tag> resolver) Construct a copy ofthis SimpleTagResolver, adding the givenresolverto the set.
-
Method Details
-
forPayloadType
Construct aSimpleTagResolverfor the givenpayloadType.The initial resolver does not construct any
Tagsyet. To addTags, additional resolvers can be included throughwithResolver(Function). -
withResolver
Construct a copy ofthis SimpleTagResolver, adding the givenresolverto the set.- Parameters:
resolver- An additionalFunctionfrom the event of typePto aTag.- Returns:
- A copy of
this SimpleTagResolver, adding the givenresolverto the set.
-
withResolver
public PayloadBasedTagResolver<P> withResolver(Function<P, String> keyResolver, Function<P, String> valueResolver) Construct a copy ofthis SimpleTagResolver, combining the givenkeyResolverandvalueResolverinto a lambda constructing aTag.- Parameters:
keyResolver- AFunctionconstructing theTag.key()for aTag.valueResolver- AFunctionconstructing theTag.value()for aTag.- Returns:
- A copy of
this SimpleTagResolver, combining the givenkeyResolverandvalueResolverinto a lambda constructing aTag.
-
resolve
Description copied from interface:TagResolver
-