Add Builder Interface / Update Builders to Implement It
-------------------------------------------------------
Key: LANG-601
URL: https://issues.apache.org/jira/browse/LANG-601
Project: Commons Lang
Issue Type: New Feature
Components: lang.builder.*
Affects Versions: 3.0
Environment: Java 1.5+
Reporter: Michael Wooten
Priority: Minor
Fix For: 3.0
I propose the addition of a Builder<T> interface that can be used to identify a
class as a builder of a concrete type of object. The interface would provide
the following method:
T build();
There are many examples of classes that define a build() method, including
BasicThreadFactory.Builder. By implementing this interface, the classes would
explicitly indicate the object type they are capable of building. Furthermore,
the interface can provide documentation on the best approach to implementing
builder classes.
I additionally suggest that the existing builder classes (CompareToBuilder,
EqualsBuilder, HashCodeBuilder, and ToStringBuilder) implement this interface.
No other changes would need to be made, since the class's build() method would
only need to return the result of the current "build" method for each of those
classes.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.