Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-601

Add Builder Interface / Update Builders to Implement It

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0
    • 3.0
    • lang.builder.*
    • None
    • Java 1.5+

    Description

      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.

      Attachments

        1. commons-lang-builder.patch
          13 kB
          Michael Wooten

        Activity

          People

            Unassigned Unassigned
            mwooten.dev Michael Wooten
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified