data
Class AbstractCurrency
java.lang.Object
data.AbstractNameable
data.ooimpl.CatalogItemImpl
data.ooimpl.CatalogImpl<CurrencyItemImpl>
data.AbstractCurrency
- All Implemented Interfaces:
- Catalog<CurrencyItemImpl>, CatalogItem, Currency<CurrencyItemImpl>, DataBasketEntryDestination, DataBasketEntrySource, DataBasketKeys, ListenableCatalog<CurrencyItemImpl>, Nameable, NameContext, SelfManagingDBEDestination<CurrencyItemImpl>, SelfManagingDBESource<CurrencyItemImpl>, Serializable, Cloneable, Comparable<Object>
- Direct Known Subclasses:
- EUROCurrencyImpl
public abstract class AbstractCurrency
- extends CatalogImpl<CurrencyItemImpl>
- implements Currency<CurrencyItemImpl>
Abstract Java implementation of the Currency
interface.
- Author:
- Thomas Medack
- See Also:
- Serialized Form
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 |
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.
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<CurrencyItemImpl>
- 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<CurrencyItemImpl>
- 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.