The @Transformer
annotation can also be added to methods that expect either the
Message
type or the message payload type. The return value will be handled in the
exact same way as described above in the section describing the <transformer> element.
@Transformer Order generateOrder(String productId) { return new Order(productId); }
Transformer methods may also accept the @Header and @Headers annotations. For example, one of those annotations may complement the payload Object as an additional parameter:
@Transformer Order generateOrder(String productId, @Header("customerName") String customer) { return new Order(productId, customer); }