javamoney
  1. javamoney
  2. JAVAMONEY-72

Harmonize Static Inner Builder classes with Builder pattern/JDK

    Details

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

      Description

      Both all relevant parts of OpenJDK (e.g. Locale.Builder or Calendar.Builder new in Java 8) and the Builder pattern by sources like Effective Java declare a method called build() for the result.

      A number of places in the API like ExchangeRate.Builder or several *Context.Builder violate this, calling it create(). Those should be harmonized with the Builder pattern/usage and its usage by JDK.

      See also
      http://www.javacodegeeks.com/2013/01/the-builder-pattern-in-practice.html

        Activity

        Hide
        atsticks added a comment -

        Should be done. How about renaming MonetaryAmountFactory to MonetaryAmountBuilder? Basically this is what it does. Only disadvantage is that it will create a funny name, since MonetaryAmountFactoryQueryBuilder must consequently renamed to MonetaryAmountBuiöderQueryBuilder... WDYT?

        Show
        atsticks added a comment - Should be done. How about renaming MonetaryAmountFactory to MonetaryAmountBuilder ? Basically this is what it does. Only disadvantage is that it will create a funny name, since MonetaryAmountFactoryQueryBuilder must consequently renamed to MonetaryAmountBuiöderQueryBuilder ... WDYT?
        Hide
        keilw added a comment -

        Not necessarily, though I recall we also have a similar case between API and RI of JSR 363 for Quantity (essentially the most comparable interface to MonetaryAmount) so trying to give the two a similar feeling where appropriate sounds like a good idea, too.

        The ticket was mainly created to have inner "Class.Builder" constructs behave like e.g. Locale.Builder, etc. with a method called build() not create() or something else. Will verify, but from that point it may be complete. Could we open another ticket for the question of MonetaryAmountFactory if you feel it should be called differently?

        Show
        keilw added a comment - Not necessarily, though I recall we also have a similar case between API and RI of JSR 363 for Quantity (essentially the most comparable interface to MonetaryAmount) so trying to give the two a similar feeling where appropriate sounds like a good idea, too. The ticket was mainly created to have inner "Class.Builder" constructs behave like e.g. Locale.Builder , etc. with a method called build() not create() or something else. Will verify, but from that point it may be complete. Could we open another ticket for the question of MonetaryAmountFactory if you feel it should be called differently?

          People

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

            Dates

            • Created:
              Updated:
              Resolved: