[JAVAMONEY-72] Harmonize Static Inner Builder classes with Builder pattern/JDK Created: 04/May/14  Updated: 05/Feb/15  Resolved: 29/Jan/15

Status: Closed
Project: javamoney
Component/s: None
Affects Version/s: 0.8
Fix Version/s: 1.0

Type: Bug Priority: Major
Reporter: keilw Assignee: keilw
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: builder, design, jdk, patterns


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

Comment by atsticks [ 02/Sep/14 ]

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?

Comment by keilw [ 02/Sep/14 ]

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?

Generated at Mon Apr 24 05:05:35 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.