[jax-rs-spec users] [jsr339-experts] Re: MessageBodyWriter Class parameter

From: Santiago Pericas-Geertsen <>
Date: Tue, 9 Oct 2012 10:40:35 -0400


> @GET
> public Book getBook() {
> if (something) {
> return SuperBook();
> } else {
> return SuperBook2();
> }
> }

 I'm assuming you mean "sub" not "super" here.

> I reckon in writeTo() it can make sense to get the return class reported by a given method to pass directly to writeTo, so that the provider can see that the first class parameter is 'Book.class', while the instance class is object.getClass().

 Without discussing the technical issue any further, this is not a backward compatible change, right? What about injecting ResourceInfo in 2.0 and getting the type from there?

-- Santiago