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:13:00 UTC
[jira] [Reopened] (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 reopened MIME4J-272:
-----------------------------------
> 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
>
> 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)