Interface BigMoneyProvider

All Known Implementing Classes:
BigMoney, Money

public interface BigMoneyProvider

Provides a uniform interface to obtain a BigMoney.

When designing APIs, it is recommended to use BigMoneyProvider in method signatures where possible to allow the widest possible use of the method. Within Joda-Money, both BigMoney and Money implement the provider interface.

Implementations of BigMoneyProvider may be mutable. To minimise the risk of the value of the provider changing while processing, any method that takes a BigMoneyProvider as a parameter should convert it to a BigMoney immediately and use that directly from then on. The method BigMoney.of(BigMoneyProvider) performs the conversion safely with null checks and is recommended for this purpose.

This interface makes no guarantees about the immutability or thread-safety of implementations.

Method Summary
 BigMoney toBigMoney()
          Returns a BigMoney instance equivalent to the value of this object.

Method Detail


BigMoney toBigMoney()
Returns a BigMoney instance equivalent to the value of this object.

It is recommended that BigMoney.of(BigMoneyProvider) is used in preference to calling this method directly. It is also recommended that the converted BigMoney is cached in a local variable instead of performing the conversion multiple times.

the converted money instance, never null
RuntimeException - if conversion is not possible

Copyright © 2009–2013 All rights reserved.