class RawMessageMapper extends AbstractMessageMapper {

    @Override
    public List<Adaptable> map(final ExternalMessage externalMessage) {
        final Optional<MessageHeaders> messageHeadersOptional =
                evaluateIncomingMessageHeaders(externalMessage, incomingMessageHeaders);
        if (messageHeadersOptional.isEmpty()) {
            // message payload is a Ditto protocol message.
            return dittoMessageMapper.map(externalMessage);
        }
        final MessageHeaders messageHeaders = messageHeadersOptional.get();
        return List.of(ProtocolFactory.newAdaptableBuilder(toTopicPath(messageHeaders))
                .withPayload(toPayload(externalMessage, messageHeaders))
                .withHeaders(retainContentTypeOnly(messageHeaders))
                .build());
    }

}