users@jsr311.java.net

GenericEntity

From: Stephan Koops <Stephan.Koops_at_web.de>
Date: Fri, 06 Jun 2008 20:47:06 +0200

Hi,
> Why not templatize Response?
that's what I wanted to say :-) But as Marc and Paul shown, it would not
work.

Until now we've had also the problem, that a resource method could not
return objects with different generic types, dependent of parameters or
whatever. So the solution with the GenericEntity is very good.

Marc, I've some small remarks for the class GenericEntity:

    * Add a message to the IllegalArgumentException in the constructor,
      e.g."The entity must not be null"
    * Do you want to switch the logic in
      getSuperclassTypeParameter(Class<?> subclass), to if (!(superclass
      instanceof ParameterizedType)) ? Who knows, what will change here
      later.
    * You should update one "<String>" to "&lt;String&gt;" in the
      preformatted part of the class javadoc.
    * Perhaps it is useful to document explicit, that the subclass
      *could be* anonymus.
    * It seems useful to me to document also in the constructors
      javadoc, that the class must be subclassed. This helps to
      understand, if someone wonders, why the constructor is not
      visible, and than sees, that it is protected.

I missed the updates on the javadoc for parameter genericType of
MessageBodyWriter.isWriteable() and .writeTo()

best regards
   Stephan