Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.8
    • Component/s: API
    • Labels:
      None
    • Environment:

      SE

      Description

      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).

      Access

      • MonetaryAmount instances can be created by calling static factory methods on the value type classes directly, e.g.
        • Money m1 = Money.of(1.456,"CHF")
        • Money m2 = Money.of(-234456,Currency.get("USD")

        Activity

        atsticks created issue -
        atsticks made changes -
        Field Original Value New Value
        Summary Abstraction for monetary amounts Abstraction for Monetary Amounts
        atsticks made changes -
        Description 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)}}.
        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)}}.

        *Access*
        * {{MonetaryAmount}} instances can be obtained using the {{MonetaryAmountFactory}} available from the {{Monetary}} singleton.
        * {{MonetaryAmount}} instances can be created by calling static factory methods on the _value type_ classes directly, e.g.
        ** {{Money m1 = Money.of(1.456,"CHF")}}
        ** {{Money m2 = Money.of(-234456,Currency.get("USD")}}
        keilw made changes -
        Original Estimate 0 minutes [ 0 ]
        Remaining Estimate 0 minutes [ 0 ]
        Fix Version/s 1.0-b01 [ 16318 ]
        Fix Version/s 0.2.0 [ 16317 ]
        atsticks made changes -
        Fix Version/s 0.3 [ 16322 ]
        Fix Version/s 1.0-b01 [ 16318 ]
        keilw made changes -
        Assignee atsticks [ atsticks ] keilw [ keilw ]
        keilw made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        atsticks made changes -
        Description 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)}}.

        *Access*
        * {{MonetaryAmount}} instances can be obtained using the {{MonetaryAmountFactory}} available from the {{Monetary}} singleton.
        * {{MonetaryAmount}} instances can be created by calling static factory methods on the _value type_ classes directly, e.g.
        ** {{Money m1 = Money.of(1.456,"CHF")}}
        ** {{Money m2 = Money.of(-234456,Currency.get("USD")}}
        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)}}.

        *Access*
        * {{MonetaryAmount}} instances can be created by calling static factory methods on the _value type_ classes directly, e.g.
        ** {{Money m1 = Money.of(1.456,"CHF")}}
        ** {{Money m2 = Money.of(-234456,Currency.get("USD")}}
        atsticks made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 0.8 [ 16791 ]
        Fix Version/s 0.3 [ 16322 ]
        Resolution Fixed [ 1 ]
        atsticks made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            keilw
            Reporter:
            atsticks
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: