Package org.axonframework.messaging.core
Interface MessageTypeResolver
- All Known Implementing Classes:
AnnotationMessageTypeResolver,ClassBasedMessageTypeResolver,HierarchicalMessageTypeResolver,NamespaceMessageTypeResolver,StructuralAwareMessageTypeResolver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface describing a resolver from
Message payload to it's
type. Used to set the type when putting the given payload on its
respective bus.- Since:
- 5.0.0
- Author:
- Allard Buijze, Mitchell Herrijgers, Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptionResolves atypefor the givenpayloadType.default Optional<MessageType> Resolves atypefor the givenpayload.default MessageTyperesolveOrThrow(Class<?> payloadType) Resolves atypefor the givenpayloadType.default MessageTyperesolveOrThrow(Object payload) Resolves atypefor the givenpayload.
-
Method Details
-
resolveOrThrow
Resolves atypefor the givenpayload. If the givenpayloadis already aMessageimplementation, theMessage Typeis returned.- Parameters:
payload- TheMessage payloadto resolve atypefor.- Returns:
- The
typefor the givenpayload. - Throws:
MessageTypeNotResolvedException- if thetypecould not be resolved.
-
resolveOrThrow
Resolves atypefor the givenpayloadType.- Parameters:
payloadType- Thetypeof theMessage payloadto resolve atypefor.- Returns:
- The
typefor the givenpayloadType. - Throws:
MessageTypeNotResolvedException- if thetypecould not be resolved.
-
resolve
Resolves atypefor the givenpayload. If the givenpayloadis already aMessageimplementation, theMessage Typeis returned.This method returns an
Optionalthat will be empty if thetypecould not be resolved.- Parameters:
payload- TheMessage payloadto resolve atypefor.- Returns:
- An
Optionalcontaining thetypefor the givenpayload, or empty if the type could not be resolved.
-
resolve
Resolves atypefor the givenpayloadType.This method returns an
Optionalthat will be empty if thetypecould not be resolved.- Parameters:
payloadType- Thetypeof theMessage payloadto resolve atypefor.- Returns:
- An
Optionalcontaining thetypefor the givenpayloadType, or empty if the type could not be resolved.
-