Currently I have a method which constructs a custom java object and passes on this object to the underlying DAO layer. Now this method is being called by n number of classes and the only difference between each of this call is one String attribute("abc" or "xyz" etc) of the custom java object. Rest of the custom java object attributes remains the same. I am thinking of modularising this method in the parent class of all these above mentioned child classes. Should i pass the variant string as mentioned earlier as an input parameter to the centralized method and in the body of the method have a switch/case to set the string attribute of the custom object accordingly. The child classes will call this method accordingly with their respective "string" value.
Is this right design choice for the problem in context.