All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.roguewave.money.currency.v1_0.MoneyFormat

java.lang.Object
   |
   +----java.text.Format
           |
           +----java.text.NumberFormat
                   |
                   +----java.text.DecimalFormat
                           |
                           +----com.roguewave.money.currency.v1_0.MoneyFormat

public class MoneyFormat
extends DecimalFormat
MoneyFormat is a convenience class which allows Money objects to be formatted directly. The class strips out the amount, whether floating point or double, and uses java.text.DecimalFormat to format it for output. Much more information can be found in the API docs for java.text.DecimalFormat and java.text.NumberFormat.

 Money money = new Money("3.234", "ATS");
 MoneyFormat formatter = new MoneyFormat("$#,###,###.00;($#,###,###.00)");
 System.out.println("formatted: " + formatter.format(money));
 

Author:
Trevor Misfeldt
See Also:
Money, Format1, Format2

Constructor Index

 o MoneyFormat()
Creates a default formatter using the default pattern and symbols.
 o MoneyFormat(String)
Creates a formatter using the given pattern and the default symbols.
 o MoneyFormat(String, DecimalFormatSymbols)
Creates a formatter with the given pattern and symbols.

Method Index

 o format(Money)
Formats the money to a string according to the pattern and symbols provided.

Constructors

 o MoneyFormat
 public MoneyFormat()
Creates a default formatter using the default pattern and symbols.

 o MoneyFormat
 public MoneyFormat(String pattern)
Creates a formatter using the given pattern and the default symbols.

Parameters:
pattern - the symbol pattern (eg. "$#,###,###.00")
 o MoneyFormat
 public MoneyFormat(String pattern,
                    DecimalFormatSymbols symbols)
Creates a formatter with the given pattern and symbols.

Parameters:
pattern - the symbol pattern (eg. "$#,###,###.00")
symbols - the desired decimal format symbols

Methods

 o format
 public String format(Money money)
Formats the money to a string according to the pattern and symbols provided.

Parameters:
money - the money to format
Returns:
the formatted string

All Packages  Class Hierarchy  This Package  Previous  Next  Index