[JAVAMONEY-72] Harmonize Static Inner Builder classes with Builder pattern/JDK Created: 04/May/14 Updated: 05/Feb/15 Resolved: 29/Jan/15
|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.
|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?