users@jersey.java.net

Re: Type argument in MessageBodyWriter methods

From: ljnelson <ljnelson_at_gmail.com>
Date: Wed, 14 Apr 2010 12:17:53 -0800 (PST)

On Wed, Apr 14, 2010 at 2:46 PM, Marc Hadley-2 [via Jersey]
<ml-node+4903420-1907593435-210534_at_n2.nabble.com> wrote:
> On Apr 14, 2010, at 1:32 PM, ljnelson wrote:
> The Type argument would be an instance of ParameterizedType whose getRawType
> would return List.class and whose getActualTypeArguments() would return an
> array of [String.class]. (I think).

Another question on this sort of thing: the T that comes in to
writeTo() in MessageBodyWriter is accompanied by a Class<?>. Was this
supposed to be Class<T>? Or was the intent that any old class could
show up here?

This leads to my next question. The first thing I need to do in my
"chaining" MessageBodyWriter is to ask Providers for another one that
matches. I'm armed at this point with a T, and a Class<?>. But
Providers#getMessageBodyWriter() needs a Class argument that has as
its parameter T. It would seem that I can't guarantee this. What's
your advice?

Best,
Laird

-- 
View this message in context: http://n2.nabble.com/Type-argument-in-MessageBodyWriter-methods-tp4902440p4903878.html
Sent from the Jersey mailing list archive at Nabble.com.