Dear JAX-RS Specification Authors,
thank you so much for the invention of JAX-RS!
Today I came across one thing that I think is not clear in the current
draft of the API, and I want to propose an improvement.
When implementing my own entity provider, I have to mark it as
@Provider, and I have to implement MessageReader and / or MessageWriter.
Both, MessageReader and MessageWriter are generic, so I can do
"implements MessageReader<Product> to specify that my Provider actually
is not "any" MessageReader but can only decode Product instances. So
far, so good.
But what I do not understand is: For what is the additional "isReadable"
/ "isWriteable" is needed? Actually, it is obvious that a
MessageReader<Product> will only aswer "true" when it got passed a
Product instance. In fact, I noticed that my MessageReader<Product> got
asked for "isReadable(String)" at Runtime -- what makes no sense in my
opinion.
Is there something inside of isReadable that I did not see yet? For me,
it looks like the "isReadable" / "isWriteable" methods can just be
dropped in favour of the generic type provided at "implements
MessageReader<T>". Another proposal could be to add the handled types at
the @Provider annotation: @Provider(types = {T.class}) could be used as
a nice replacement for implementing "isReadable" / "isWriteable".
Thanks
Markus
--
http://www.xing.com/go/invita/58469