Hi,
I have fixed things in the trunk so that a type variable, T say,
declared as a parameter or a return type of a resource method will be
resolved. Which means you can do stuff like the following:
public static abstract class AResource<T, V> {
@QueryParam("v") V fieldV;
V methodV;
@QueryParam("v")
public void set(V methodV) {
this.methodV = methodV;
}
@GET
public String get(@QueryParam("v") V getV) {
return getV.toString() + fieldV.toString() +
methodV.toString();
}
@POST
public T post(T t) {
return t;
}
@Path("sub")
@POST
public T postSub(T t) {
return t;
}
}
@Path("/")
@Produces("application/xml")
public static class CollectionJAXBResource extends
AResource<Collection<JAXBBean>, String> {
}
But types like T[] and Collection<T> are not currently supported for
reasons previously discussed.
TODO, add warning/error support to resource validation when a type
variable cannot be resolved, or if a parameterized type has at least
one type argument (directly or indirectly) that is a type variable.
Paul.
On Sep 4, 2009, at 12:24 AM, Tatu Saloranta wrote:
> On Thu, Sep 3, 2009 at 1:03 AM, Paul Sandoz<Paul.Sandoz_at_sun.com>
> wrote:
>>
>>> Personally I would probably be fine by declaring this as something
>>> to
>>> be done later if ever. :-)
>>
>> OK :-) intellectually it would be an interesting challenge (i think
>> i know
>> what steps need to be done), but there are currently other more
>> important
>> things that need to be done.
>
> Yeah that's what think too -- it's a very interesting problem, and
> it's good to know theoretical vs practical limits on solving things.
>
> -+ Tatu +-
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>