javamoney
  1. javamoney
  2. JAVAMONEY-2

Make CurrencyUnit or adequate replacement an Interface

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      As one of the main goals of the JSR is to support Custom Currencies, the straw man draft of CurrencyUnit based on JodaMoney will not work for it.

      In fact, JSR 310 showed something like a "pattern" by introducing an interface PeriodUnit, then implemented by types such as LocalPeriodUnit.

      Hence, CurrencyUnit (or another name if anybody has a better one) should be an interface, and (just an example) "LocalCurrencyUnit" or similar be implementing classes. Whether or not an enum would work for some implementations is probably worth exploring.

      If enums won't work, then either the getInstance(), the of() or a different factory.
      Java generally has valueOf(). It seems, of() is an attempt of a shorter version.
      None of the common JVM languages seem to use that, Fantom has make() as constructor and from*() especially fromString(), but no of*() either.

      -> Harmonize across API, where concrete Money types have similar factory methods.

        Activity

        Hide
        keilw added a comment -

        As of new repository CurrencyUnit was turned into an interface.
        To be implemented by java.util.Currency in a matching version of OpenJDK or any equivalent currency type in other platforms, e.g. CLDC 8.

        Show
        keilw added a comment - As of new repository CurrencyUnit was turned into an interface. To be implemented by java.util.Currency in a matching version of OpenJDK or any equivalent currency type in other platforms, e.g. CLDC 8.

          People

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

            Dates

            • Due:
              Created:
              Updated:
              Resolved: