com.ibm.dse.appl.ej.base
Class ConvertAmountFormat

java.lang.Object
  |
  +--com.ibm.dse.base.ObjectFormat
        |
        +--com.ibm.dse.appl.ej.base.ConvertAmountFormat

public class ConvertAmountFormat
extends ObjectFormat

The ConvertAmountFormat class is used to format a BigDecmial based on a currency code. Amount is stored in database as a BigDecimal with decimal moved to the far right. Based on the currency code stored with the Currency Data Name, we can shift the decimal back to its own place. It is used with the HashtableFormat.

See Also:
ObjectFormat, HashtableFormat, Serialized Form

Fields inherited from class com.ibm.dse.base.ObjectFormat
dataElementName, key
 
Constructor Summary
ConvertAmountFormat()
           
 
Method Summary
 java.lang.Object format(DataElement aDataElement)
          Formats aDataElement and returns it as an Object.
protected  java.lang.String getAmountDataName()
          Get a amount data name
protected  java.lang.String getCurrencyDataName()
          Get a currency data name
protected  java.util.ListResourceBundle getResourceBundle()
          Get a resource bundle
 java.lang.Object initializeFrom(Tag aTag)
          Initializes an ConvertAmountFormat with the Tag attributes.
protected  void setAmountDataName(java.lang.String dataName)
          Set an amount data name
protected  void setCurrencyDataName(java.lang.String dataName)
          Set a currency data name
protected  void setResourceBundle(java.lang.String rbName)
          Set a resource bundle by giving a resource bundle name
 DataElement unformat(java.lang.Object aValue, DataElement aDataElement)
          Shift the decimal place of the BigDecimal stored with the AmountDataName.
 
Methods inherited from class com.ibm.dse.base.ObjectFormat
externalizer, getDataElementName, getExternalizer, getKey, getName, getTagName, readExternal, readExternal, removeExternal, setDataElementName, setKey, setName, toString, toStrings, toTags, writeExternal, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConvertAmountFormat

public ConvertAmountFormat()
Method Detail

format

public java.lang.Object format(DataElement aDataElement)
Formats aDataElement and returns it as an Object. This method should only be invoked by the format() method of HashtableFormat because this method does not return a String.
Overrides:
format in class ObjectFormat
Parameters:
aDataElement - DataElement, the data element within the operation context to be formatted
Returns:
Object, the value in the data element aDataElement
See Also:
DataElement

getAmountDataName

protected java.lang.String getAmountDataName()
Get a amount data name
Returns:
String, an amount data name

getCurrencyDataName

protected java.lang.String getCurrencyDataName()
Get a currency data name
Returns:
String, a currency data name

getResourceBundle

protected java.util.ListResourceBundle getResourceBundle()
Get a resource bundle
Returns:
ListResourceBundle, a resource bundle
See Also:
ListResourceBundle

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException,
                                       DSEException
Initializes an ConvertAmountFormat with the Tag attributes.
Overrides:
initializeFrom in class ObjectFormat
Parameters:
aTag - Tag, a Tag
Returns:
Object, this object
Throws:
IOException, - throws when problem occurs in accessing SGML files
DSEException, - throws when problem occurs in DSE
See Also:
Tag

setAmountDataName

protected void setAmountDataName(java.lang.String dataName)
Set an amount data name
Parameters:
String, - an amount data name

setCurrencyDataName

protected void setCurrencyDataName(java.lang.String dataName)
Set a currency data name
Parameters:
String, - a currency data name

setResourceBundle

protected void setResourceBundle(java.lang.String rbName)
Set a resource bundle by giving a resource bundle name
Parameters:
String, - a resource bundle name

unformat

public DataElement unformat(java.lang.Object aValue,
                            DataElement aDataElement)
                     throws DSEInvalidArgumentException
Shift the decimal place of the BigDecimal stored with the AmountDataName. Number of decimal place can be located in a reource bundle using the currency code as a key. This method should only be invoked from the unformat() method of HashtableFormat.
Overrides:
unformat in class ObjectFormat
Parameters:
aValue - Object, a value, not used in this case
aDataElement - DataElement, the data element within the operation context to be formatted
Returns:
DataElement, a DataElement
See Also:
DataElement