Latest Tweets

 

Java Money

The project that’s been taking up so much of my time recently is to architect a complex B2B e-commerce system. This naturally requires some form of “monetary abstraction” which is something that Java doesn’t provide (quite a surprise really, when you think about some of the classes that have made it into the system libraries over the years).

This is also something that the Java community doesn’t appear to have addressed in any significant way. Faced with this situation on the current project, I contributed my own small collection of classes for dealing with monetary amounts via the expedient of open-sourcing them and then treating them as I would any other third-party library.

This is a one line example that just about sums-up the whole library. Here’s how you make $100:

new MoneyType(Locale.US).money(10).calc().multiply(BigDecimal.TEN).money();

A page containing all relevant links to downloads, documentation etc. is available on my website:

http://www.tomgibara.com/projects/money