I have a data object that is holding a meny BigDecimal object as well as String and other type of object in my data object class. what is the best way to do some common operation on the BigDecimal field like intrest rate
interest=interest.setScale(2, RoundingMode.HALF_UP);
I could do it in the setters/ getter but it could be more erroneous I want to make sure that every variable has been treat by same method.
I could have some helper class that could be called from the setter or setter. I hate to write any code in the helper.
Is there any other good way I could do this ?
I would use the setters for that. If I had to do that to all BigDecimal fields I would consider extend the BigDecimal and code the treatment on the constructor.