Source:
<code>public static <T, U> PollerFlux<PollResult<T>, U> create( SerializerAdapter serializerAdapter, HttpPipeline pipeline, Type pollResultType, Type finalResultType, Duration defaultPollInterval, Mono<Response<Flux<ByteBuffer>>> lroInitMono) { Objects.requireNonNull(serializerAdapter, "'serializerAdapter' cannot be null."); Objects.requireNonNull(pipeline, "'pipeline' cannot be null."); Objects.requireNonNull(pollResultType, "'pollResultType' cannot be null."); Objects.requireNonNull(finalResultType, "'finalResultType' cannot be null."); Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); Objects.requireNonNull(lroInitMono, "'lroInitMono' cannot be null."); <START> Function<PollingContext<PollResult<T>>, Mono<PollResult<T>>> defaultLroInitOperation = context -> lroInitMono <END> .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getValue()) .map(contentBytes -> { String content = new String(contentBytes, StandardCharsets.UTF_8); PollingState state = PollingState.create(serializerAdapter, response.getRequest(), response.getStatusCode(), response.getHeaders(), content); state.store(context); T result = deserialize(serializerAdapter, content, pollResultType); return new PollResult<>(result); })); return new PollerFlux<>(defaultPollInterval, defaultLroInitOperation, pollFunction(serializerAdapter, pipeline, pollResultType), cancelFunction(), fetchResultFunction(serializerAdapter, pipeline, finalResultType)); }</code><technical_language>wish is re-use code in core for deserialization (<LINK_0> is complicated logic (handle wired type, handle HEAD method, etc.). often, a hidden deviation of implementation. I is hard reuse core code... asking for advice</technical_language>

Target:
public static <T, U> PollerFlux<PollResult<T>, U> create( SerializerAdapter serializerAdapter, HttpPipeline pipeline, Type pollResultType, Type finalResultType, Duration defaultPollInterval, Mono<Response<Flux<ByteBuffer>>> lroInitMono) { Objects.requireNonNull(serializerAdapter, "'serializerAdapter' cannot be null."); Objects.requireNonNull(pipeline, "'pipeline' cannot be null."); Objects.requireNonNull(pollResultType, "'pollResultType' cannot be null."); Objects.requireNonNull(finalResultType, "'finalResultType' cannot be null."); Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); Objects.requireNonNull(lroInitMono, "'lroInitMono' cannot be null."); Function<PollingContext<PollResult<T>>, Mono<PollResponse<PollResult<T>>>> defaultLroInitOperation = context -> lroInitMono.flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getValue()) .map(contentBytes -> { String content = new String(contentBytes, StandardCharsets.UTF_8); PollingState state = PollingState.create(serializerAdapter, response.getRequest(), response.getStatusCode(), response.getHeaders(), content); state.store(context); T result = deserialize(serializerAdapter, content, pollResultType); return new PollResponse<>(state.getOperationStatus(), new PollResult<>(result)); })); return PollerFlux.create(defaultPollInterval, defaultLroInitOperation, pollFunction(serializerAdapter, pipeline, pollResultType), cancelFunction(), fetchResultFunction(serializerAdapter, pipeline, finalResultType)); }