--- On Tue, 2/24/09, Paul Sandoz <Paul.Sandoz_at_Sun.COM> wrote:
> > Hi Paul,
> >
> > What do you think about overloading the method and
> passing the class type, something like
> >
> > public Response getPersones() {
> > return Response.ok().entity(listPersones(),Persona.class).build();
> > }
>
> Unfortunately that is not a generic solution to the issue,
> what if i had a type of Map<String, String> or
> List<Set<String>> ?
>
> The only generic solution we found was to use another
> class, GenericEntity, to keep hold of the type information.
> This solution was inspired by Guice 1.0, which provides
> something similar.
Is this application of "super type token" pattern (
http://gafter.blogspot.com/2006/12/super-type-tokens.html)?
That is, having type like:
TypeDef def = new TypeDef<Map<String,Integer>>() { }
which can be used to pass generic type information despite type erasure?
That is what I ended up using, and works well, just ends up creating lots of dummy classes.
-+ Tatu +-