users@jersey.java.net

Type argument in MessageBodyWriter methods

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Wed, 14 Apr 2010 11:31:58 -0400

I wonder if someone would be kind enough to talk more about the
java.lang.reflect.Type argument in, say, the writeTo() method of
MessageBodyWriter (see
http://java.sun.com/javaee/6/docs/api/javax/ws/rs/ext/MessageBodyWriter.html#writeTo%28T,%20java.lang.Class,%20java.lang.reflect.Type,%20java.lang.annotation.Annotation[],%20javax.ws.rs.core.MediaType,%20javax.ws.rs.core.MultivaluedMap,%20java.io.OutputStream%29
for details).

From staring at the Javadoc, I don't see how it differs from the
java.lang.Class argument. I mean, I know how java.lang.reflect.Type
differs from java.lang.Class, but I don't understand the origin of
this parameter, or whether it's always required, or whether it might
be null, or whether I'm obliged to consider it, or all of those other
contractual details that aren't spelled out in the, er, contract. :-)

Thanks,
Laird