P - The type of the translated message's payload@FunctionalInterface
public interface MessageTranslator<P>
The Message Translator is the messaging equivalent of the Adapter pattern described in [GoF]. An adapter converts the interface of a component into a another interface so it can be used in a different context.
| Modifier and Type | Method and Description |
|---|---|
static <P> MessageTranslator<P> |
of(java.util.function.Function<java.lang.Object,P> payloadTranslator)
Creates a MessageTranslator that is translating the message payload using the specified
Function,
+while keeping Message.getKey() and Message.getHeader() as-is. |
Message<P> |
translate(Message<?> message)
Translates a Message into a Message with payload-type <P>
|
static <P> MessageTranslator<P> of(java.util.function.Function<java.lang.Object,P> payloadTranslator)
Function,
+while keeping Message.getKey() and Message.getHeader() as-is.P - The type of the resulting Message's payload.payloadTranslator - the function used to translate the message payload.