Tellier Benoit created MIME4J-272:
-------------------------------------
Summary: 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: Tellier Benoit
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
(v7.6.3#76005)