Value object getter
Posted
by sarah xia
on Stack Overflow
See other posts from Stack Overflow
or by sarah xia
Published on 2010-03-22T02:25:09Z
Indexed on
2010/03/22
2:31 UTC
Read the original article
Hit count: 430
Hi,
I've got a value object, which stores info for example amount. The getAmount() getter returns amount in cents. However in various places, we need to get amount in dollar. There are 2 approaches I can think of:
- write a convert method and place it in a utility class.
- add a getAmountInDollar() getter in the value object.
I prefer the second approach. What do you think? What are pros and cons of both approaches?
© Stack Overflow or respective owner