mardi 6 juin 2017

pass different objects to the same method java

i have method to build an object which has been passed as method parameters. the method will construct the user-defined objects after performing some logic which is common across different classes.

for ex: an array-list will be present in each object in which i used to iterate the entire list and set some values based on the inputs (passed as parameter) and update the existing object with the newly passed values.

I tried with strategy pattern where i see that the method implementation still needs to be taken care in all the classes. My question is if we do in that way then there will be only a one liner changer which is getting the list from the object so it violates the design pattern.

any help would be appreciated

Aucun commentaire:

Enregistrer un commentaire