Interface ResponseMapper
- All Known Subinterfaces:
WebResponseMapper
- All Known Implementing Classes:
DefaultResponseMapper, DefaultWebResponseMapper
public interface ResponseMapper
A strategy interface for converting arbitrary response objects into
Message instances.
This abstraction allows handler return values (or other types of responses) to be wrapped in a consistent message
format, optionally including Metadata.
Implementations may handle different return types (e.g., plain objects, enriched result objects, or already wrapped
Message instances) depending on the needs of the message pipeline.
Use Cases
- Transforming handler return values into
Messageenvelopes for result publication - Injecting custom metadata or headers into result messages
- Supporting custom serialization formats or protocols
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionMaps the given response object to aMessage.Maps the given response object and metadata to aMessage.default ObjectmapPayload(Object response) Maps a synchronously completed handler result to the value returned by the gateway.
-
Method Details
-
map
-
mapPayload
Maps a synchronously completed handler result to the value returned by the gateway.The default obtains the payload from
map(Object). Implementations may override this method to avoid creating an intermediateMessage, but the returned value must be identical tomap(response).getPayload().- Parameters:
response- the value returned by the handler- Returns:
- the payload to return from the gateway
-
map
-