/** * Create a builder for a new {@link Message} instance with the provided payload. * * @param payload the payload for the new message * @param <T> The type of the payload. * @return A MessageBuilder. */ public static <T> MessageBuilder<T> withPayload(T payload) { return new MessageBuilder<T>(payload, null); }
/** * Create a builder for a new {@link Message} instance pre-populated with all of the headers copied from the * provided message. The payload of the provided Message will also be used as the payload for the new message. * * @param message the Message from which the payload and all headers will be copied * @param <T> The type of the payload. * @return A MessageBuilder. */ public static <T> MessageBuilder<T> fromMessage(Message<T> message) { Assert.notNull(message, "message must not be null"); return new MessageBuilder<T>(message.getPayload(), message); }
/** * Create a builder for a new {@link Message} instance with the provided payload. * * @param payload the payload for the new message * @param <T> The type of the payload. * @return A MessageBuilder. */ public static <T> MessageBuilder<T> withPayload(T payload) { return new MessageBuilder<T>(payload, null); }
/** * Create a builder for a new {@link Message} instance pre-populated with all of the headers copied from the * provided message. The payload of the provided Message will also be used as the payload for the new message. * * @param message the Message from which the payload and all headers will be copied * @param <T> The type of the payload. * @return A MessageBuilder. */ public static <T> MessageBuilder<T> fromMessage(Message<T> message) { Assert.notNull(message, "message must not be null"); return new MessageBuilder<T>(message.getPayload(), message); }