com.ibm.etill.framework.payapi
Class Amount

java.lang.Object
  |
  +--com.ibm.etill.framework.payapi.Amount
All Implemented Interfaces:
Serializable

public final class Amount
extends Object
implements Serializable

Amount objects contain the attributes associated with a specific currency amount value. Three attributes are associated with an amount instance:

Amount objects are used throughout the Framework to represent amount values associated with various payment transactions.

See Also:
Serialized Form

Constructor Summary
Amount(short icurrency, int iamount, int iamountExp10)
          Constructs an Amount object with the specified currency code, amount and amount exponent values.
Amount(String icurrency, String iamount, String iamountExp10)
          Constructs an Amount object with the specified currency code, amount and amount exponent String representations.
 
Method Summary
static String currencyAsString(short currency)
          Converts the input currency code to a 3-digit string.
 boolean currencyMatch(Amount arg)
          Returns true if currency and amountExp10 of the argument match.
 int getamount()
          Deprecated. Use getAmount()
 int getAmount()
          Returns the amount value from this Amount object.
 int getamountExp10()
          Deprecated. Use getAmountExp10()
 int getAmountExp10()
          Returns the base10 exponent value from this Amount object.
 short getcurrency()
          Deprecated. Use getCurrency()
 short getCurrency()
          Returns the currency value from this Amount object.
 String getcurrencyAsString()
          Deprecated. Use getCurrencyAsString()
 String getCurrencyAsString()
          Returns this object's currency code as a 3-digit string.
 String toString()
          Returns a string representation of this Amount object for tracing purposes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Amount

public Amount(short icurrency,
              int iamount,
              int iamountExp10)
Constructs an Amount object with the specified currency code, amount and amount exponent values.
Parameters:
icurrency - a short containing the ISO 4217 currency code
iamount - an int containing the amount value without a decimal point
iamtExp10 - an int containing the base10 exponent to indicate the correct placement of the decimal point

Amount

public Amount(String icurrency,
              String iamount,
              String iamountExp10)
Constructs an Amount object with the specified currency code, amount and amount exponent String representations.
Parameters:
icurrency - a String containing the ISO 4217 currency code. This value will be converted into a short before being stored.
iamount - a String containing the amount value without a decimal point. This value will be converted into an int before being stored.
iamtExp10 - a String containing the base10 exponent to indicate the correct placement of the decimal point. This value will be converted into an int before being stored.
Throws:
NumberFormatException - thrown if any of the numeric conversions fail
Method Detail

getCurrency

public short getCurrency()
Returns the currency value from this Amount object.
Returns:
short - the ISO 4217 currency code

getcurrency

public short getcurrency()
Deprecated. Use getCurrency()


getAmount

public int getAmount()
Returns the amount value from this Amount object.
Returns:
int - the amount value without a decimal point

getamount

public int getamount()
Deprecated. Use getAmount()


getAmountExp10

public int getAmountExp10()
Returns the base10 exponent value from this Amount object.
Returns:
int - the base10 exponent value, which indicates the correct positioning of the decimal point within the amount value.

getamountExp10

public int getamountExp10()
Deprecated. Use getAmountExp10()


getCurrencyAsString

public String getCurrencyAsString()
Returns this object's currency code as a 3-digit string. For example, this method would return the following strings for the following currency codes:
Code  String
840   "840"
27   "027"
5   "005"
Returns:
String - the ISO 4217 currency code as a string, padded on the left with zeros if necessary.

getcurrencyAsString

public String getcurrencyAsString()
Deprecated. Use getCurrencyAsString()


currencyAsString

public static String currencyAsString(short currency)
Converts the input currency code to a 3-digit string. For example, this method would return the following strings for the following currency codes:
Code  String
840   "840"
27   "027"
5   "005"
Returns:
String - the string representation of the input code, padded on the left with zeros if necessary.

currencyMatch

public boolean currencyMatch(Amount arg)
Returns true if currency and amountExp10 of the argument match.
Returns:
Boolean - true if currency and amountExp10 match

toString

public String toString()
Returns a string representation of this Amount object for tracing purposes.
Overrides:
toString in class Object
Returns:
String - a string representation of the key elements of this object.