com.goldeninnovations.smp
Class EmailAddress

java.lang.Object
  extended by com.goldeninnovations.smp.EmailAddress

public class EmailAddress
extends Object

Represents a single email address.

Provides get/set methods to access userName, domain, and full email address.


Constructor Summary
EmailAddress(String emailAddress)
          Parses the address to verify it is valid.
 
Method Summary
 boolean equals(Object obj)
           
 String getDomain()
          Returns the domain portion of the email address.
 String getUserName()
          Returns the userName portion of the email address.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EmailAddress

public EmailAddress(String emailAddress)
             throws IllegalArgumentException
Parses the address to verify it is valid.

Parameters:
emailAddress - the full email address.
Throws:
IllegalArgumentException - thrown when the specified email address is invalid.
Method Detail

getUserName

public String getUserName()
Returns the userName portion of the email address. Everything before the @ character.

For john.smith@example.com, this method would return 'john.smith'

Returns:
the userName portion of the EmailAddress.

getDomain

public String getDomain()
Returns the domain portion of the email address. Everything after the @ character.

For john.smith@example.com, this method would return 'example.com'

Returns:
the domain portion of the EmailAddress.

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2010 Eric Daugherty. All Rights Reserved.