Question: package cs 1 3 0 2 . hw 0 6 ; import java.time.LocalDate; / * * Represents an Email message in the cs 1 3
package cshw; import java.time.LocalDate; Represents an Email message in the cs mock eLC application. @author Brad Barnes @version ; Mar public class Email Email address of the recipient. private String recipient; Email address of the sender private String sender; Date sent. private LocalDate sendDate; Contents of the Email message. private String contents; Constructs a new @code Email object. All parameters must be specified and nonnull. @code java.lang.String parameters must not be empty and any @code java.lang.String parameter representing an email address must be a valid email address. @throws NullPointerException if any argument is @code null @throws IllegalArgumentException if any of the @code java.lang.String arguments are empty or if the email addresses are invalid. @param recipient email address of the recipient. @param sender email address of the sender @param sendDate @code java.time.LocalDate reference representing the date the email was sent. @param contents the message contents message body public EmailString recipient, String sender LocalDate sendDate String contents checkNullEmail Constructor", contents, sendDate recipient, sender; checkEmptyEmail Constructor", recipient, sender contents; checkAddressEmail Constructor", recipient, sender; this.sender sender; this.recipient recipient; this.sendDate sendDate; this.contents contents; Email Returns the date that the Email was originally sent. @return the @code java.time.LocalDate this @code Email was sent. public LocalDate getDateSent return sendDate; getSendDate Returns the email address of the recipient as a @code java.lang.String @return the email address of the recipient of this @code Email object. public String getRecipient return recipient; getRecipient Returns the email address of the sender as a @code java.lang.String @return the email address of the sender of this @code Email object. public String getSender return sender; getSender Returns the contents of this @code Email as a @code java.lang.String @return the contents of this @code Email object. public String getContents return contents; getSender Throws a @code NullPointerException if any of the supplied values are @code null The method performs no actions if all values are not @code null @param method The name of the calling method. @param values The values to verify. The number of values is variable and may be zero. @throws NullPointerException if any of the supplied values are @code null private void checkNullString method, Object values for Object value: values if value null throw new NullPointerExceptionmethod : Null Argument Provided"; if for checkNull Throws an IllegalArgumentException if any @code Strings in the varargs parameter, @code s are empty. The method performs no actions if all values in @code s are nonnull. @param method the name of the calling method. @param s varargs parameter containing all strings to verify @throws IllegalArgumentException if any element of parameter @code s is empty. private void checkEmptyString method, String s for String str: s if strequals throw new IllegalArgumentExceptionmethod : Empty String Provided"; if for checkEmpty Throws an IllegalArgumentException if any @code Strings in the varargs parameter, @code s do not contain a valid email address. This method considers an email address valid if it contains the @code @ symbol and a @code somewhere after the @code @ This method for checking validity would not hold up in a realworld system. For more information on accurately checking email validity, see the link below. The method performs no actions if all values in @code s contain
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
