com.retek.commons.util
Class MoneyUtility

java.lang.Object
  extended bycom.retek.commons.util.MoneyUtility

public class MoneyUtility
extends java.lang.Object

Money Utility object that helps the UI format and unformat certain data.


Constructor Summary
MoneyUtility()
           
 
Method Summary
static Money getMoney(java.lang.String amount)
          Retrieves a money object for the string amount.
static Money getMoney(java.lang.String amount, boolean returnNull)
          Retrieves a money object for the string amount.
static java.lang.String getString(Money money)
          Retrieves the string value of the money object.
static java.lang.String getString(Money money, boolean defaultEmpty)
          Retrieves the string value of the money object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoneyUtility

public MoneyUtility()
Method Detail

getMoney

public static Money getMoney(java.lang.String amount)
Retrieves a money object for the string amount. Returns zero if the string is empty.

Parameters:
amount - The amount to convert into a money object.

Throws:
java.lang.NumberFormatException - Thrown if the amount cannot be converted into Money.

getMoney

public static Money getMoney(java.lang.String amount,
                             boolean returnNull)
Retrieves a money object for the string amount.

Parameters:
amount - The amount to convert into a money object.
returnNull - If true, method returns null for empty amounts. If false, returns $0.00

Throws:
java.lang.NumberFormatException - Thrown if the amount cannot be converted into Money.

getString

public static java.lang.String getString(Money money)
Retrieves the string value of the money object. Returns $0.00 if Money is null.

Parameters:
money - The money object to convert to a string.

Returns:
The string value of the money object.

getString

public static java.lang.String getString(Money money,
                                         boolean defaultEmpty)
Retrieves the string value of the money object.

Parameters:
money - The money object to convert to a string.
defaultEmpty - If true, returns empty string for empty money. If false, returns $0.00.

Returns:
The string value of the money object.


Copyright © 2005 Retek Inc. All Rights Reserved. - Generated at Fri, 01/21/2005 14:25