lundi 30 octobre 2017

Why does JAX_RS use ResponseBuilder to build Response

I see that

Response.ok(entity).build();

returns Response via ResponseBuilder, and that it is a common pattern to arrive at the target object(Response in this case) through an intermediate object(ResponseBuilder). Why is it so? Why not directly do something like:

ResponseBuilder.one-step-ok-build(entity);

Aucun commentaire:

Enregistrer un commentaire