Class PCurrencyFormatter

All Implemented Interfaces:
Serializable, Cloneable

public class PCurrencyFormatter extends DecimalFormat
PCurrencyFormatter is a concrete subclass of DecimalFormat that formats currency numbers based on currency instead of default locale of the system.

There is no public constructor for PCurrencyFormatter. To obtain a PCurrencyFormatter for a specific currency, call getInstance(int currencyID).

See Also:
  • Method Details

    • setContext

      public static void setContext(PortalContext connection)
      Sets the PortalContext. You only need to call it once during the whole life span of the application. This is usually called in the initialization of an client application. If the client tool is not connected to Portal server and you don't call the setContext(). The Currency formatter will have the default behaviors that are defined by the CurrencyFormatter.properties file.
      Parameters:
      connection - A PortalContext object.
    • getRoundingMethod

      public static int getRoundingMethod(int currencyID)
      Gets the rounding method for a specific currency defined in the currency resource in beid configuration object stored at Portal server.
      Parameters:
      currencyID - the currency ID
      Returns:
      the rounding method defined in beid configuration object. If setContext() has not been called to set the connection, returns -1.
    • isCurrencyID

      public static boolean isCurrencyID(int currencyID)
      Checks if the currency ID is a valid ISO currency ID that is recognized by Portal.
      Parameters:
      currencyID - the currency ID to evaluate.
      Returns:
      Return true if the ID is a valid ISO currency, otherwise return false.
    • getInstance

      public static PCurrencyFormatter getInstance(int currencyID)
      Gets an instance of PCurrencyFormatter for a specific currency ID.
      Parameters:
      currencyID - The currency ID.
      Returns:
      an instance of PCurrencyFormatter for the currency ID.