Skip to main content

[JIRA] Created: (JAVAMONEY-16) Abstraction for monetary amounts

  • From: "atsticks (JIRA)" <jira-no-reply@...>
  • To: issues@...
  • Subject: [JIRA] Created: (JAVAMONEY-16) Abstraction for monetary amounts
  • Date: Fri, 1 Feb 2013 08:22:53 +0000 (GMT+00:00)
  • Auto-submitted: auto-generated

Abstraction for monetary amounts
--------------------------------

                 Key: JAVAMONEY-16
                 URL: http://java.net/jira/browse/JAVAMONEY-16
             Project: javamoney
          Issue Type: New Feature
          Components: Spec: core
         Environment: SE
            Reporter: atsticks
            Assignee: atsticks
             Fix For: 0.2.0


Model an interface {{MonetaryAmount}} and an according value type as follows:
* the interface {{MonetaryAmount}} is designed as immutable, the 
implementation classes must be {{final}} and immutable.
* a {{MonetaryAmount}} has a {{CurrencyUnit}} attached, each amount instance 
must have a {{CurrencyUnit}}.
* a {{MonetaryAmount}} has a numeric value, which may is *NOT exposed*. 
* For interoperability {{MonetaryAmount}} provides converters to several 
types similar as defined on {{java.lang.Number}}.
* For additional interoperability the {{MonetaryAmount}} defines a method 
{{<T> T asType<Class<T>)}} which allows to extract arbitrary representation 
types.
** in a SE environment, it is required that 
*** all number types extending {{java.lang.Number}} must be supported.
*** {{java.math.BigDecimal}} and {{java.math.BigInteger}} must be also 
supported.
*** when passing {{java.lang.Number.class}} BigDecimal is returned as result 
type.
** in other environments this should be similar. If not possible, alternate 
types are allowed.
* {{MonetaryAmount}} also provides basic arithmetic functions similar to 
{{java.math.BigDecimal}}. Extended functionality must be modelled using the 
Java Money extension SPI.
* the methods {{String toPlainString()}} and {{String toEngineeringString()}} 
are supported similarly as in {{java.math.BigDecimal}}, whereas in this case 
the {{CurrencyUnit}} is prepended, e.g. ISO-4217:CHF 1234.35
* Additional arithmetic operations not defined on {{MonetaryAmount}} can be 
applied by passing an {{AmountAdjuster}} instance to {{MonetaryAmount 
with(AmountAdjuster...)}}.
* Finally a {{MonetaryAmount}} with a different numeric value, but the same 
currency can be created by calling {{MonetaryAmount.width(java.lang.Number)}}.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[JIRA] Created: (JAVAMONEY-16) Abstraction for monetary amounts

atsticks (JIRA) 02/01/2013

[JIRA] Updated: (JAVAMONEY-16) Abstraction for Monetary Amounts

atsticks (JIRA) 02/01/2013

[JIRA] Updated: (JAVAMONEY-16) Abstraction for Monetary Amounts

atsticks (JIRA) 02/05/2013

[JIRA] Updated: (JAVAMONEY-16) Abstraction for Monetary Amounts

keilw (JIRA) 02/06/2013

[JIRA] Updated: (JAVAMONEY-16) Abstraction for Monetary Amounts

atsticks (JIRA) 02/16/2013
 
 
Close
loading
Please Confirm
Close