• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • 4.5.0
    • 4.3.0
    • None
    • None
    • 4.5 M2

      Seriously, consider using OOP.
      One method has 16 arguments..

          [RUNTIME-3297] Review SendMailHelper API

          For instance

           

          SendMailHelper has just one method

          MailFactory newMailFactory();

           

          class MailFactory has many (15 I think) methods

          MailFactory withSubject(String subject)
          MailFactory withRecipient(String recipient)
          MailFactory withBody(String body)

          etc.

          and a method to build it into a mail

          Mail build();

          which can throw IllegalStateException if the recipient was not set for instance, etc.

          Mail has 2 methods

          void sendAsHtml();
          void sendAsText;

          Simon Prieul (Inactive) added a comment - For instance   SendMailHelper has just one method MailFactory newMailFactory();   class MailFactory has many (15 I think) methods MailFactory withSubject( String subject) MailFactory withRecipient( String recipient) MailFactory withBody( String body) etc. and a method to build it into a mail Mail build(); which can throw IllegalStateException if the recipient was not set for instance, etc. Mail has 2 methods void sendAsHtml(); void sendAsText;

            cedric Cédric Damioli
            sprieul Simon Prieul (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: