01: package net.sf.jmoney.fields;
02:
03: /**
04: * This interface defines methods that convert an amount to
05: * and from a string representation suitable for display to
06: * the user or input from the user.
07: *
08: * All commodity objects can provide an implementation of this
09: * interface. This allows the format of an amount to depend on
10: * the commodity to which the amount refers. For example, if
11: * the commodity were US dollars then 34125 may be formatted as
12: * 341.25. On the other hand if the commodity were a stock then
13: * the same amount may be formatted as 3.41 1/4.
14: *
15: * It is possible that the user may enter an amount before entering
16: * the commodity to which the amount refers. To allow this, an
17: * implementation of this interface may also be provided by other
18: * classes such as an account class.
19: */
20: public interface IAmountFormatter {
21:
22: String format(long longValue);
23:
24: long parse(String amountString);
25:
26: }
|