public class QuantityManager extends UnitManager
ROUND_METHOD_FLOOR, ROUND_METHOD_ROUND, ROUND_METHOD_TRUNCATION
Modifier and Type | Method and Description |
---|---|
QuantityAmount |
convert(QuantityAmount aQuantityAmount,
java.lang.String toQuantityUnit)
Convert a quantity amount to a new quantity unit.
|
java.util.List |
getConvertableUnits(java.lang.String aUnit)
Get all quantity units that can be converted from/to
|
java.lang.Double |
getCustomizedRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aUnit)
Gets the unit to which rounding occurs.
|
java.lang.Double |
getCustomizedRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aUnit,
java.lang.String aNumberUsage)
Gets the unit to which rounding occurs.
|
java.lang.String |
getCustomizedString(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aQuantityUnit,
java.lang.Integer aLanguageId)
Get the customized string from the format table.
|
java.lang.String |
getDescription(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aQuantityUnit,
java.lang.Integer aLanguageId)
Get the description of the specified quantity unit.
|
FormattedQuantityAmount |
getFormattedQuantityAmount(QuantityAmount aQuantityAmount,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.Integer aLanguageId)
Get a formatted quantity amount for display purposes based on the formatting
rules defined in the database.
|
FormattedQuantityAmount |
getFormattedQuantityAmount(QuantityAmount aQuantityAmount,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.Integer aLanguageId,
java.lang.String aNumberUsage)
Get a formatted quantity amount for display purposes based on the formatting
rules defined in the database.
|
static QuantityManager |
getInstance()
Get the instance of the quantity manager.
|
java.lang.Double |
getRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aUnit)
Gets the unit to which rounding occurs.
|
java.lang.Double |
getRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aUnit,
java.lang.String aNumberUsage)
Gets the unit to which rounding occurs.
|
java.lang.String |
getSymbol(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aQuantityUnit,
java.lang.Integer aLanguageId)
Get the quantity symbol information from the quantity format table.
|
void |
initialize()
Used by the registry manager to initialize the quantity manager.
|
java.lang.Double |
parsePositiveAmount(java.lang.String anAmount,
java.lang.String theUnit,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.Integer aLanguageId,
java.lang.String aNumberUsage)
Parses a string (representing a positive number) based on the formatting rules defined in the database.
|
void |
round(QuantityAmount aQuantityAmount,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean)
Round the quantity amount to the appropriate number of decimal places.
|
void |
round(QuantityAmount aQuantityAmount,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aNumberUsage)
Round the quantity amount to the appropriate number of decimal places.
|
void |
roundCustomized(QuantityAmount aQuantityAmount,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean)
Perform customized rounding to the correct number of decimal places.
|
void |
roundCustomized(QuantityAmount aQuantityAmount,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aNumberUsage)
Perform customized rounding to the correct number of decimal places.
|
getCustomizedRoundMethod, getCustomizedRoundMethod, getCustomizedString, getDescription, getNumberOfDecimalPlaces, getNumberOfDecimalPlaces, getSymbol, isRefreshRequired, refresh, setRefreshRequired
public QuantityAmount convert(QuantityAmount aQuantityAmount, java.lang.String toQuantityUnit) throws com.ibm.commerce.exception.ECSystemException
aQuantityAmount
- a quantity amount to be converted.toQuantityUnit
- the quantity unit to convert to.null
is returned.com.ibm.commerce.exception.ECSystemException
public java.util.List getConvertableUnits(java.lang.String aUnit)
aUnit.
aUnit
- the starting quantity unit.aUnit(including
aUnit).
public java.lang.Double getCustomizedRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aUnit) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store for which the rounding applies.aUnit
- the quantity unit for which the rounding applies.com.ibm.commerce.exception.ECSystemException
public java.lang.Double getCustomizedRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aUnit, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store for which the rounding applies.aUnit
- the quantity unit for which the rounding applies.aNumberUsage
- the number usage code.com.ibm.commerce.exception.ECSystemException
public java.lang.String getCustomizedString(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aQuantityUnit, java.lang.Integer aLanguageId) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store for choosing the customized string.aQuantityUnit
- the quantity unit for which to choose the customized string.aLanguageId
- the language Id of the language for the customized string.com.ibm.commerce.exception.ECSystemException
public java.lang.String getDescription(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aQuantityUnit, java.lang.Integer aLanguageId) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store that the description applies to.aQuantityUnit
- the quantity unit that the description is for.aLanguageId
- the language Id of the language for the description.com.ibm.commerce.exception.ECSystemException
public FormattedQuantityAmount getFormattedQuantityAmount(QuantityAmount aQuantityAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.Integer aLanguageId) throws com.ibm.commerce.exception.ECSystemException
aQuantityAmount
- the quantity amount to format.aStoreAccessBean
- a store.aLanguageId
- a language ID.com.ibm.commerce.exception.ECSystemException
public FormattedQuantityAmount getFormattedQuantityAmount(QuantityAmount aQuantityAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.Integer aLanguageId, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException
aQuantityAmount
- the quantity amount to format.aStoreAccessBean
- a store.aLanguageId
- a language ID.aNumberUsage
- the number usage code.com.ibm.commerce.exception.ECSystemException
public static QuantityManager getInstance() throws com.ibm.commerce.exception.ECSystemException
com.ibm.commerce.exception.ECSystemException
public java.lang.Double getRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aUnit) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store for which the rounding applies.aUnit
- the quantity unit for which the rounding applies.com.ibm.commerce.exception.ECSystemException
public java.lang.Double getRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aUnit, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store for which the rounding applies.aUnit
- the quantity unit for which the rounding applies.aNumberUsage
- the number usage code.com.ibm.commerce.exception.ECSystemException
public java.lang.String getSymbol(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aQuantityUnit, java.lang.Integer aLanguageId) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store.aQuantityUnit
- the quantity unit.aLanguageId
- the language Id of the language for the symbol.com.ibm.commerce.exception.ECSystemException
public void initialize() throws java.lang.Exception
java.lang.Exception
public java.lang.Double parsePositiveAmount(java.lang.String anAmount, java.lang.String theUnit, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.Integer aLanguageId, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException, java.text.ParseException
anAmount
- the amount to parse.theUnit
- the unit of the value.aStoreAccessBean
- a store access bean.aLanguageId
- a language ID.aNumberUsage
- The number usage code to use.com.ibm.commerce.exception.ECSystemException
java.text.ParseException
public void round(QuantityAmount aQuantityAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean) throws com.ibm.commerce.exception.ECSystemException
roundingMultipleand
roundingMethodcolumns of the quantity format table.
aQuantityAmount
- the quantity amount to round.aStoreAccessBean
- the store.com.ibm.commerce.exception.ECSystemException
public void round(QuantityAmount aQuantityAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException
roundingMultipleand
roundingMethodcolumns of the quantity format table.
aQuantityAmount
- the quantity amount to round.aStoreAccessBean
- the store.aNumberUsage
- the number usage code.com.ibm.commerce.exception.ECSystemException
public void roundCustomized(QuantityAmount aQuantityAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean) throws com.ibm.commerce.exception.ECSystemException
roundingMultipleand
roundingMethodcolumns of the quantity format table.
aQuantityAmount
- the quantity amount to round.aStoreAccessBean
- the store.com.ibm.commerce.exception.ECSystemException
public void roundCustomized(QuantityAmount aQuantityAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException
roundingMultipleand
roundingMethodcolumns of the quantity format table.
aQuantityAmount
- the quantity amount to round.aStoreAccessBean
- the store.aNumberUsage
- the number usage code.com.ibm.commerce.exception.ECSystemException