Class MultiPrinterParser
- java.lang.Object
-
- org.joda.money.format.MultiPrinterParser
-
- All Implemented Interfaces:
java.io.Serializable,MoneyParser,MoneyPrinter
final class MultiPrinterParser extends java.lang.Object implements MoneyPrinter, MoneyParser, java.io.Serializable
Prints and parses multiple printers/parsers.This class is immutable and thread-safe.
-
-
Field Summary
Fields Modifier and Type Field Description private MoneyParser[]parsersThe parsers.private MoneyPrinter[]printersThe printers.private static longserialVersionUIDSerialization version.
-
Constructor Summary
Constructors Constructor Description MultiPrinterParser(MoneyPrinter[] printers, MoneyParser[] parsers)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidappendTo(MoneyFormatterBuilder builder)(package private) booleanisParser()(package private) booleanisPrinter()voidparse(MoneyParseContext context)Parses monetary information using a textual representation.voidprint(MoneyPrintContext context, java.lang.Appendable appendable, BigMoney money)Prints part of a monetary value to the output appendable.java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serialization version.- See Also:
- Constant Field Values
-
printers
private final MoneyPrinter[] printers
The printers.
-
parsers
private final MoneyParser[] parsers
The parsers.
-
-
Constructor Detail
-
MultiPrinterParser
MultiPrinterParser(MoneyPrinter[] printers, MoneyParser[] parsers)
Constructor.- Parameters:
printers- the printers, not null
-
-
Method Detail
-
isPrinter
boolean isPrinter()
-
isParser
boolean isParser()
-
appendTo
void appendTo(MoneyFormatterBuilder builder)
-
print
public void print(MoneyPrintContext context, java.lang.Appendable appendable, BigMoney money) throws java.io.IOException
Description copied from interface:MoneyPrinterPrints 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.
- Specified by:
printin interfaceMoneyPrinter- Parameters:
context- the context being used, not nullappendable- the appendable to add to, not nullmoney- the money to print, not null- Throws:
java.io.IOException- if an IO exception occurs
-
parse
public void parse(MoneyParseContext context)
Description copied from interface:MoneyParserParses monetary information using a textual representation.The text and parse index are stored in the context. The parsed data and updated index is also stored in the context.
Implementations should avoid throwing exceptions and use the error index in the context instead to record the problem. The context can be assumed to not be in error on entry to this method.
The context is not a thread-safe object and a new instance will be created for each parse. The context must not be stored in an instance variable or shared with any other threads.
- Specified by:
parsein interfaceMoneyParser- Parameters:
context- the context to use and parse into, not null
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-