mardi 10 avril 2018

Instead of builder pattern involving a separate static class is it possible to just do it directly on the object itself, given the object is mutable?

So the object I am trying to create can be mutable. Is it okay to do something like this:

GetUserTopicsQuery request = GetUserTopicsQuery.getInstance().setUserId(mUserId).setName("Bob");

where setUserId returns GetUserTopicsQuery after setting the field userId and setName sets the name field.

Aucun commentaire:

Enregistrer un commentaire