Interface MessageTranslator<P extends Message<?>>

  • Type Parameters:
    P - The type of the translated message's payload
    All Superinterfaces:
    java.util.function.Function<Message<?>,​P>
    All Known Implementing Classes:
    TextMessageTranslator
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface MessageTranslator<P extends Message<?>>
    extends java.util.function.Function<Message<?>,​P>
    Translates any Message<?> into a Message with payload-type P by translating the message's payload into the specified target-type payload.

    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.

    MessageTranslator

    See Also:
    EIP: Message Translator
    • Method Summary

      Modifier and Type Method Description
      P apply​(Message<?> message)
      Translates a Message into a Message with payload-type <P>
      • Methods inherited from interface java.util.function.Function

        andThen, compose
    • Method Detail

      • apply

        @Nonnull
        P apply​(@Nonnull
                Message<?> message)
        Translates a Message into a Message with payload-type <P>
        Specified by:
        apply in interface java.util.function.Function<Message<?>,​P extends Message<?>>
        Parameters:
        message - Message<?>
        Returns:
        Message<P>