Hi,
we have several "update" methods in our JAX-RS services, with similar signature:

    @PUT
    @Path("{key}")
    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
void update(@NotNull @PathParam("key") String key, @NotNull ResourceTO resourceTO);

For various reasons, the key value is already contained in the ResourceTO bean; this leads to kind of redundant invocations like as

resourceService.update(resourceTO.getKey(), resourceTO);

I was wondering whether this situation can be improved by using @BeanParam:

    void update(@BeanParam ResourceTO resourceTO);

by annotating ResourceTO#setKey() with @Path("{key}").

It seems that with such setup only "key" is evaluated, e.g. the rest of ResourceTO instance is left empty.

Am I missing something? Any suggestion to fix the original problem?

Thanks for your support.
Regards.


Reply via email to