public interface MoneyPrinter
Prints part of a monetary value to the output appendable.
The printer may print any part, or the whole, of the input BigMoney
.
Typically, a complete print is constructed from a number of smaller printers
that have been combined using MoneyFormatterBuilder
.
This interface must be implemented with care to ensure other classes operate correctly. All instantiable implementations must be thread-safe, and should generally be final and immutable.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
print
(MoneyPrintContext context, Appendable appendable, BigMoney money) Prints part of a monetary value to the output appendable.
-
Method Details
-
print
Prints part of a monetary value to the output appendable.The implementation determines what to append, which may be some or all of the data held in the
BigMoney
.The context is not a thread-safe object and a new instance will be created for each print. The context must not be stored in an instance variable or shared with any other threads.
- Parameters:
context
- the context being used, not nullappendable
- the appendable to add to, not nullmoney
- the money to print, not null- Throws:
MoneyFormatException
- if there is a problem while printingIOException
- if an IO exception occurs
-