Claude Warren created CLI-333:
---------------------------------
Summary: Define Builder as an implementation of Supplier
Key: CLI-333
URL: https://issues.apache.org/jira/browse/CLI-333
Project: Commons CLI
Issue Type: New Feature
Components: CLI-1.x, Help formatter, Parser
Affects Versions: 1.7.0
Reporter: Claude Warren
The Builder pattern as described by the gang of four and general
implementations across multiple blogs and source packages creates a complex
pattern when a method is called. That method specified in the pattern
description is "getResult", however the review of several blogs and
implementations indicate that "build", "getX" "toX" are all popular names for
the production method.
In Java the Supplier interface defines a producer of X and stipulates that
every time the production method is called an instance of X must be returned.
It does allow for the same instance to be returned for every call.
Thus a Builder is a customization of the Supplier. As commons strives to
utilize the JRE patterns over custom patterns, it makes sense that all Builders
should implement Supplier.
Therefore this change is to have all Builders
# implement Supplier and add a get() method (if not already present)
# have the current producer method delegate to the get() method
# mark the current producer method as deprecated with a note to use get.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)