pkg utilities Email - yshehab/SchoolRoomBooking GitHub Wiki

Email Class

Overview

Models an email address.

Email is immutable, non-unique, and has no natural ordering.

An Email instance will be validated on creation and will throw an IllegalArgumentException if it is invalid.

Package

UtilityClasses

Constructor

public Email(String email)

    Pre-condition: must be a valid email or an IllegalArgumentException will be thrown.

    Post-condition: returns an instance of eMail from the supplied arguments

Static Members

None

Static Methods

None

Attributes

private String email the email string

Links

None

Protocol

public String toString(String email)

    Post-condition: Returns a string representation of the receiver

Inner Classes

private class EMailValidator

Members

private java.util.regex.Pattern pattern

private java.util.regex.Matcher matcher

private final String EMAIL_PATTERN

Methods

private boolean validate(String email)

    Post-condition: returns true if email is a valid email otherwise false.

Examples

Discussion

  • e-mails should be unique. Should we make then so?