lundi 28 décembre 2015

How to create object based on boolean condition?

I have an Item object having 4 String fields and 3 boolean fields. I have to construct this object based on the 3 boolean variables. The target is whenever any one of the boolean variable is true we have to create the object having that/those boolean variable set. If for any situation none of the boolean variables are true, we wont create the object. I am using a COR to check whether any of the boolean fields will be set or not based on some business logic. I was trying this with builder, but then I have to construct so many objects and later discard them when none of the boolean variables found true.

Can anyone have any better idea, to solve this kind of problem ?

Aucun commentaire:

Enregistrer un commentaire