Dealing with monetary values consistently in a large application is important.
Things that need to be considered are:-
precision rounding display formatting multi-currency database persistence
This collection of classes deals with the above issues.
The core Money class is a drop in
... [More]
replacement for BigDecimal with added functionality to deal with monetary values. If offers the following features:-
Consistent precision JDBC and JPA database persistence Self awareness Logging
Self awareness?Sometimes you need to have processing rules for a specific monetary field. Let's say that VAT needs to be calculated consistently across multiple applications. When a Money object is instantiated it can be given a name. Straight away this is used in any log messages. A listener can register its interest in all Money objects of a given name. Now whenever the field is changed or stored the listener is invoked where it can reprocess the value or take other customer actions. [Less]