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
Message
envelopes for result publication - Injecting custom metadata or headers into result messages
- Supporting custom serialization formats or protocols
- See Also:
-
Method Summary
-
Method Details
-
map
- Parameters:
response
- the response object to be mapped- Returns:
- a
Message
representing the response
-
map
Maps the given response object and metadata to aMessage
.- Parameters:
response
- the response object to be transformedmetadata
- optional metadata to include in the message- Returns:
- a
Message
representing the response and metadata
-