On Apr 14, 2010, at 1:32 PM, ljnelson wrote:
> On Wed, Apr 14, 2010 at 1:22 PM, Marc Hadley-2 [via Jersey]
> <[hidden email]> wrote:
> > Type gives more information that Class. E.g. the class of List<String> is
> > List.class, you need the Type to determine that its actually a list of
> > strings. In many cases you probably won't care about the difference, its
> > provided for those cases where you do care.
>
> OK; is it accurate to say that the Class argument could have been
> discarded entirely? Not arguing that it should, just that Type is a
> superset of Class, so you really only NEED that one argument. Just
> trying to cement my understanding.
>
Strictly speaking you are right but working with Type can be quite complicated (e.g. see below) so we thought it was worth the duplication.
> (Would the Type argument in your example be String, or List<String>?
> Presumably the latter.)
>
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).
Marc.