Because in that "more complex" style you can write this then…
Client rxClient = client.register(Java8.class); // i. e. technically a CompletionStageRxInvokerProvider, which effectively is part of JAX-RS!!!
CompletionStage<UserPojo> cs =
rxClient.target( <
http://foo.bar/> "
http://foo.bar")
.request()
.rx(CompletionStage.class)
.get(UserPojo.class);
…so the average programmer clearly understands that this will register Java 8 as one possible RX provider (possibly in addition to others), so he can get a CompletionStage. It feels just more correct and simple, particular for JAX-RS beginners. They will not understand why they shall repeat the provider again and again, and they will not understand why rx(T) will return not return T. But I think they will accept to repeat the stage again and again, as stages are not reusable (they are used to do that with stages already).
-Markus
From: Santiago Pericasgeertsen [mailto:santiago.pericasgeertsen_at_oracle.com]
Sent: Donnerstag, 19. Januar 2017 16:55
To: jsr370-experts_at_jax-rs-spec.java.net
Subject: Re: [jax-rs-spec users] JAX-RS 2.1 - work schedule
Hi Pavel,
Just catching up with this issue. I guess the two levels of indirection has led us into a generic wall :)
Client rxClient = client.register(CompletionStageRxInvokerProvider.class);
CompletionStage<UserPojo> cs =
rxClient.target( <
http://foo.bar/> "
http://foo.bar")
.request()
.rx(CompletionStage.class)
.get(UserPojo.class);
So what if we reduce indirection and write:
.rx(CompletionStageRxInvoker.class)
as before, still keeping the provider for it? Less ideal of course.
— Santiago