Uploaded image for project: 'James Mime4j'
  1. James Mime4j
  2. MIME4J-272

Ease builder uses by implicitly calling build when possible.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Reopened
    • Major
    • Resolution: Unresolved
    • None
    • 0.8.2
    • dom
    • None

    Description

      While using mime4J DOM builders, we often ends up using builders to build a builder argument.

      However, the caller needs to convert the builder into the wanted object calling the build method. This conversion can be a bit boiler plate. Thus Mime4J should offer an opportunity to implicitly call "build" in non ambiguoud situations.

      Example:

      Message message = Message.Builder.of()
                  .setBody(MultipartBuilder.create("report")
                      .addBodyPart(BodyPartBuilder.create()
                          .setBody(SingleBodyBuilder.create()
                              .setText("first")
                              .buildText())
                          .build())
                      .addBodyPart(mdn)
                      .build())
                  .build();
      

      Would become:

      Message message = Message.Builder.of()
                  .setBody(MultipartBuilder.create("report")
                      .addBodyPart(BodyPartBuilder.create()
                          .setBody(SingleBodyBuilder.create()
                              .setText("first")
                              .buildText()))
                      .addBodyPart(mdn))
                  .build();
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            btellier Benoit Tellier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: