SalesPoint Framework v3.1

data
Class AbstractCurrency

java.lang.Object
  extended bydata.AbstractNameable
      extended bydata.ooimpl.CatalogItemImpl
          extended bydata.ooimpl.CatalogImpl
              extended bydata.AbstractCurrency
All Implemented Interfaces:
Catalog, CatalogItem, Cloneable, Comparable, Currency, DataBasketEntryDestination, DataBasketEntrySource, DataBasketKeys, ListenableCatalog, Nameable, NameContext, SelfManagingDBEDestination, SelfManagingDBESource, Serializable
Direct Known Subclasses:
EUROCurrencyImpl

public abstract class AbstractCurrency
extends CatalogImpl
implements Currency

Abstract Java implementation of the Currency interface.

Author:
Thomas Medack
See Also:
Serialized Form

Nested Class Summary
protected  class AbstractCurrency.CurrencyItemData
          Data container for names and values of CurrencyItems.
 
Field Summary
 
Fields inherited from class data.ooimpl.CatalogImpl
m_lhListeners, m_nModCount
 
Fields inherited from class data.AbstractNameable
m_ncContext, m_pcsPropertyListeners
 
Fields inherited from interface data.CatalogItem
VALUE_PROPERTY
 
Fields inherited from interface data.Nameable
NAME_PROPERTY
 
Fields inherited from interface data.DataBasketKeys
CATALOG_ITEM_MAIN_KEY, STOCK_ITEM_MAIN_KEY
 
Constructor Summary
AbstractCurrency(String sName)
          Create a new AbstractCurrency with a default locale of Locale.GERMANY and fill it.
AbstractCurrency(String sName, Locale l)
          Create a new, initially empty AbstractCurrency for the given locale.
 
Method Summary
protected abstract  AbstractCurrency.CurrencyItemData[] getCurrencyItemData()
          This abstract method allows the programmer to choose the names and values of the CurrencyItems (EURO, DM, ...).
 NumberValue parse(String s)
          Try to interpret the given String according to the currency format of the specific currency.
 String toString(NumberValue nv)
          Convert the given value into a String representation according to the currency format of the specific currency.
 
Methods inherited from class data.ooimpl.CatalogImpl
add, addCatalogChangeListener, checkNameChange, commitAdd, commitRemove, contains, createPeer, fireCanEditCatalogItem, fireCanRemoveCatalogItem, fireCatalogItemAddCommit, fireCatalogItemAdded, fireCatalogItemAddRollback, fireCatalogItemRemoveCommit, fireCatalogItemRemoved, fireCatalogItemRemoveRollback, fireCommitEditCatalogItem, fireEditingCatalogItem, fireRollbackEditCatalogItem, get, getEditableCopy, getEditingItemsContainer, getItemsContainer, getItemsLock, getNCMonitor, getShallowClone, getTemporaryAddedItemsContainer, getTemporaryRemovedItemsContainer, iterator, keySet, nameHasChanged, remove, remove, removeCatalogChangeListener, rollbackAdd, rollbackRemove, size, toString
 
Methods inherited from class data.ooimpl.CatalogItemImpl
addValueListener, compareTo, equals, getCatalog, getValue, isEditable, removeValueListener, setValue
 
Methods inherited from class data.AbstractNameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface data.Catalog
add, contains, get, iterator, keySet, remove, remove, size
 
Methods inherited from interface data.CatalogItem
addValueListener, getCatalog, getValue, removeValueListener
 
Methods inherited from interface data.Nameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

AbstractCurrency

public AbstractCurrency(String sName,
                        Locale l)
Create a new, initially empty AbstractCurrency for the given locale.

Parameters:
sName - the name of the currency to create.
l - the locale that determines how currency values will be formatted.

AbstractCurrency

public AbstractCurrency(String sName)
Create a new AbstractCurrency with a default locale of Locale.GERMANY and fill it.

Parameters:
sName - the name of the new currency.
Method Detail

parse

public NumberValue parse(String s)
                  throws ParseException
Try to interpret the given String according to the currency format of the specific currency.

Specified by:
parse in interface Currency
Parameters:
s - the text to be parsed
Returns:
the interpreted value in the smallest unit of the currency.
Throws:
ParseException - if the input could not be parsed.
Override:
Always

toString

public String toString(NumberValue nv)
Convert the given value into a String representation according to the currency format of the specific currency. nv must be given in the smallest unit of the currency, i.e. if you want to specify 5,05 DM nv should be 505.

Specified by:
toString in interface Currency
Parameters:
nv - the value to be converted
Returns:
formatted String.
Override:
Always

getCurrencyItemData

protected abstract AbstractCurrency.CurrencyItemData[] getCurrencyItemData()
This abstract method allows the programmer to choose the names and values of the CurrencyItems (EURO, DM, ...). A complete list of data containers, which always contain pairs of name and value, has to be returned. The single CurrencyItems can be found in the Catalog (Currency) with those names.

Returns:
an Array of data containers that contain names and values of CurrencyItems to be added.

SalesPoint Framework v3.1