Interface BigMoneyProvider
-
public interface BigMoneyProviderProvides a uniform interface to obtain aBigMoney.This interface provides an abstraction over
MoneyandBigMoney. In general, applications should use the concrete types, not this interface. However, utilities and frameworks may choose to make use of this abstraction.Implementations of
BigMoneyProvidermay be mutable. To minimise the risk of the value of the provider changing while processing, any method that takes aBigMoneyProvideras a parameter should convert it to aBigMoneyimmediately and use that directly from then on. The methodBigMoney.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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BigMoneytoBigMoney()Returns aBigMoneyinstance equivalent to the value of this object.
-
-
-
Method Detail
-
toBigMoney
BigMoney toBigMoney()
Returns aBigMoneyinstance 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 convertedBigMoneyis cached in a local variable instead of performing the conversion multiple times.- Returns:
- the converted money instance, never null
- Throws:
java.lang.RuntimeException- if conversion is not possible
-
-