Top Description Fields Constructors Methods
org.joda.money.format

pack-priv final Class SignedPrinterParser

extends Object
implements MoneyPrinter, MoneyParser, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.joda.money.format.MoneyParser, org.joda.money.format.MoneyPrinter
Imports
java.io.IOException, .Serializable, java.math.BigDecimal, org.joda.money.BigMoney

Prints and parses using delegated formatters, one for positive and one for megative.

This class is immutable and thread-safe.

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Serialization version.

private final MoneyFormatter
whenNegative

The formatter to use when negative.

private final MoneyFormatter
whenPositive

The formatter to use when positive.

private final MoneyFormatter
whenZero

The formatter to use when zero.

Constructor Summary

AccessConstructor and Description
pack-priv
SignedPrinterParser(MoneyFormatter
the formatter to use when the amount is positive
whenPositive
,
MoneyFormatter
the formatter to use when the amount is zero
whenZero
,
MoneyFormatter
the formatter to use when the amount is positive
whenNegative
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
parse(MoneyParseContext
the context to use and parse into, not null
context
)

Implements org.joda.money.format.MoneyParser.parse.

Parses monetary information using a textual representation.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Serialization version.

whenNegativeback to summary
private final MoneyFormatter whenNegative

The formatter to use when negative.

whenPositiveback to summary
private final MoneyFormatter whenPositive

The formatter to use when positive.

whenZeroback to summary
private final MoneyFormatter whenZero

The formatter to use when zero.

Constructor Detail

SignedPrinterParserback to summary
pack-priv SignedPrinterParser(MoneyFormatter whenPositive, MoneyFormatter whenZero, MoneyFormatter whenNegative)

Constructor.

Parameters
whenPositive:MoneyFormatter

the formatter to use when the amount is positive

whenZero:MoneyFormatter

the formatter to use when the amount is zero

whenNegative:MoneyFormatter

the formatter to use when the amount is positive

Method Detail

parseback to summary
public void parse(MoneyParseContext context)

Implements org.joda.money.format.MoneyParser.parse.

Doc from org.joda.money.format.MoneyParser.parse.

Parses 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.

Parameters
context:MoneyParseContext

the context to use and parse into, not null

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override