Class Currency

java.lang.Object
org.jpos.iso.Currency
All Implemented Interfaces:
Serializable

public class Currency extends Object implements Serializable
ISO Currency Conversion package
See Also:
  • Constructor Details

    • Currency

      public Currency(String alphacode, int isocode, int numdecimals)
      Creates a Currency with the given code and decimal count.
      Parameters:
      alphacode - ISO alpha code (e.g. "USD")
      isocode - ISO numeric code
      numdecimals - number of decimal places
  • Method Details

    • getDecimals

      public int getDecimals()
      Returns the number of decimal places for this currency.
      Returns:
      decimal count
    • getIsoCode

      public int getIsoCode()
      Returns the ISO numeric currency code.
      Returns:
      ISO numeric code
    • getAlphaCode

      public String getAlphaCode()
      Returns the ISO alpha currency code.
      Returns:
      alpha code (e.g. "USD")
    • formatAmountForISOMsg

      public String formatAmountForISOMsg(double amount)
      Formats an amount for inclusion in an ISO message (zero-padded, 12 digits).
      Parameters:
      amount - the amount to format
      Returns:
      12-character zero-padded string
    • parseAmountFromISOMsg

      public double parseAmountFromISOMsg(String isoamount)
      Parses an ISO amount string into a double by applying the currency's decimal shift.
      Parameters:
      isoamount - the ISO-formatted amount string (no decimal point)
      Returns:
      the decimal amount value
    • toString

      public String toString()
      Overrides:
      toString in class Object