users@jax-rs-spec.java.net

[jax-rs-spec users] Re: JAX-RS 2.1 - work schedule

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Sun, 15 Jan 2017 18:11:25 +0100

On 14/01/2017 00:53, Markus KARG wrote:

> we have different possibilities. (a) We provide adapters, just as we
> do with value types. The interface could look like "<T> T get()" so in
> fact it accepts any return type at compile time, and it is up to the
> developer to provide an adapter that actually provides T at runtime
> (otherwise he ends up with ClassCastException). (b) We do not create
> the instance of the RX type inside JAX-RS but the let the application
> do that explicitly, just as it does in any Java program outside JAX-RS
> currently (the charter to be reactive does not imply that the API must
> have any special client API methods that produce RX instances, it
> might be enough to process pre-built instances).
>

please note that <T> T get() plus accepting provider would force
implementation to do at least one unchecked cast. I would like to not
force these cast if possible.

And we would need to limit the number of providers to exactly one, since
there is no way how to get <T> from get() method implementation so we
cannot make sure that the provider actually implements functionality
requires for the requested type. (or iterate over them and catch
ClassCastException .. anyway, not an elegant solution in my opinion).

Regards,
Pavel