You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by "Benoit Tellier (Jira)" <mi...@james.apache.org> on 2021/04/16 03:14:00 UTC

[jira] [Updated] (MIME4J-272) Ease builder uses by implicitly calling build when possible.

     [ https://issues.apache.org/jira/browse/MIME4J-272?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benoit Tellier updated MIME4J-272:
----------------------------------
    Fix Version/s: 0.8.2

> Ease builder uses by implicitly calling build when possible.
> ------------------------------------------------------------
>
>                 Key: MIME4J-272
>                 URL: https://issues.apache.org/jira/browse/MIME4J-272
>             Project: James Mime4j
>          Issue Type: Improvement
>          Components: dom
>            Reporter: Benoit Tellier
>            Priority: Major
>             Fix For: 0.8.2
>
>
> 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:
> {code:java}
> Message message = Message.Builder.of()
>             .setBody(MultipartBuilder.create("report")
>                 .addBodyPart(BodyPartBuilder.create()
>                     .setBody(SingleBodyBuilder.create()
>                         .setText("first")
>                         .buildText())
>                     .build())
>                 .addBodyPart(mdn)
>                 .build())
>             .build();
> {code}
> Would become:
> {code:java}
> Message message = Message.Builder.of()
>             .setBody(MultipartBuilder.create("report")
>                 .addBodyPart(BodyPartBuilder.create()
>                     .setBody(SingleBodyBuilder.create()
>                         .setText("first")
>                         .buildText()))
>                 .addBodyPart(mdn))
>             .build();
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)