Is there a way to use the @ElementClass hint with returns that are List<>
or Arrays? I have a resource that I want the WADL to generate showing the
response element correctly and my methods return Response objects. On the
methods that return singular objects I can use @ElementClass( response =
Module.class) and the WADL will include the proper element in the response
section. I can't seem to get the same results with methods that return
List<String> or Module[]. I can define the Array one with @ElementClass(
response = Module[].class) but the element class in the WADL isn't present.
I can't even define the generic List approach.
Is there a way to handle this?
Examples:
This works great and the WADL includes the element.
@GET
@PATH("/module")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@ElementClass(response = Module.class)
public Response getModule() { ... }
This generates a WADL with a missing element tag
@GET
@PATH("/modules")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@ElementClass(response = Module[].class)
public Response getModules() { ... }
This just doesn't work at all since you can't get a class object from a
List like this (i.e. won't compile).
@GET
@PATH("/modules")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@ElementClass(response = List<Module>.class)
public Response getModules() { ... }
Module is a JAXB object that is generated from a schema.
Thanks,
Chris