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

        keilw created issue -
        keilw made changes -
        Field Original Value New Value
        Original Estimate 0 minutes [ 0 ]
        Remaining Estimate 0 minutes [ 0 ]
        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.
        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.
        keilw made changes -
        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.
        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.
        keilw made changes -
        Assignee keilw [ keilw ]
        keilw made changes -
        Due Date 2012-12-01 00:00:00.0
        keilw made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        keilw made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Due:
              Created:
              Updated:
              Resolved: