@@ -200,41 +200,41 @@ interface RequestSpec {
200200 RequestSpec metadata (Object metadata , MimeType mimeType );
201201
202202 /**
203- * Provide request payload data. The given Object may be a synchronous
204- * value, or a {@link Publisher} of values, or another async type that's
205- * registered in the configured {@link ReactiveAdapterRegistry}.
206- * <p>For multi-valued Publishers, prefer using
207- * {@link #data(Publisher, Class)} or
208- * {@link #data(Publisher, ParameterizedTypeReference)} since that makes
209- * it possible to find a compatible {@code Encoder} up front vs looking
210- * it up on every value.
203+ * Provide payload data. The data can be one of the following:
204+ * <ul>
205+ * <li>Concrete value
206+ * <li>{@link Publisher} of value(s)
207+ * <li>Any other producer of value(s) that can be adapted to a
208+ * {@link Publisher} via {@link ReactiveAdapterRegistry}
209+ * </ul>
211210 * @param data the Object to use for payload data
212211 * @return spec for declaring the expected response
213212 */
214213 ResponseSpec data (Object data );
215214
216215 /**
217- * Provide a {@link Publisher} of value(s) for request payload data.
218- * <p>Publisher semantics determined through the configured
219- * {@link ReactiveAdapterRegistry} influence which of the 4 RSocket
220- * interactions to use. Publishers with unknown semantics are treated
221- * as multi-valued. Consider registering a reactive type adapter, or
222- * passing {@code Mono.from(publisher)}.
223- * <p>If the publisher completes empty, possibly {@code Publisher<Void>},
224- * the request will have an empty data Payload.
225- * @param publisher source of payload data value(s)
226- * @param dataType the type of values to be published
227- * @param <T> the type of element values
228- * @param <P> the type of publisher
216+ * Alternative of {@link #data(Object)} that accepts not only a producer
217+ * of value(s) but also a hint for the types of values that will be
218+ * produced. The class hint is used to find a compatible {@code Encoder}
219+ * once, up front, and used for all values.
220+ * @param producer the source of payload data value(s). This must be a
221+ * {@link Publisher} or another producer adaptable to a
222+ * {@code Publisher} via {@link ReactiveAdapterRegistry}
223+ * @param elementType the type of values to be produced
229224 * @return spec for declaring the expected response
230225 */
231- < T , P extends Publisher < T >> ResponseSpec data (P publisher , Class <T > dataType );
226+ ResponseSpec data (Object producer , Class <?> elementType );
232227
233228 /**
234- * Variant of {@link #data(Publisher, Class)} for when the dataType has
235- * to have a generic type. See {@link ParameterizedTypeReference}.
229+ * Alternative of {@link #data(Object, Class)} but with a
230+ * {@link ParameterizedTypeReference} hint which can provide generic
231+ * type information.
232+ * @param producer the source of payload data value(s). This must be a
233+ * {@link Publisher} or another producer adaptable to a
234+ * {@code Publisher} via {@link ReactiveAdapterRegistry}
235+ * @param elementTypeRef the type of values to be produced
236236 */
237- < T , P extends Publisher < T >> ResponseSpec data (P publisher , ParameterizedTypeReference <T > dataTypeRef );
237+ ResponseSpec data (Object producer , ParameterizedTypeReference <?> elementTypeRef );
238238 }
239239
240240
0 commit comments