JohnPortella
JohnPortella

Reputation: 1821

Resteasy mapping @PathParam and @QueryParam to Pojo

I want to reduce my lines of code in a restful ws. My service is :

@GET
    @Path("/acc_bloq/{unit}/{id}/search")
    @Produces("application/json")
    public FiltroBean getAcc_Bloq(@PathParam("unit") String unit,
           @PathParam("id") int id, @QueryParam("init") int init, @QueryParam("end") int end){}

Is there any way to mapping directly the parameters to a POJO? so to save lines of code

Filter filter = new Filter()
filter.set....
filter.set...

Thanks in advance.

Upvotes: 1

Views: 2595

Answers (1)

pgiecek
pgiecek

Reputation: 8230

I think that @BeanParam is what you are looking for.

The annotation that may be used to inject custom JAX-RS "parameter aggregator" value object into a resource class field, property or resource method parameter.

Upvotes: 4

Related Questions