Package com.helger.base.email
Class EmailAddress
java.lang.Object
com.helger.base.email.EmailAddress
- All Implemented Interfaces:
IEmailAddress,IHasDisplayName
This class handles a single email address. It is split into an address part and an optional name.
The personal name is optional and may be
null.- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionEmailAddress(@NonNull IEmailAddress aAddress) Copy constructor.EmailAddress(@NonNull String sAddress) Constructor with address only.EmailAddress(@NonNull String sAddress, @Nullable String sPersonal) Constructor with address and optional personal name. -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable EmailAddresscreateOnDemand(@Nullable String sAddress) Factory method that creates anEmailAddressonly if the provided address is non-empty.static @Nullable EmailAddresscreateOnDemand(@Nullable String sAddress, @Nullable String sPersonal) Factory method that creates anEmailAddressonly if the provided address is non-empty.boolean@NonNull String@Nullable StringinthashCode()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.base.email.IEmailAddress
getDisplayName, hasPersonal
-
Constructor Details
-
EmailAddress
Copy constructor.- Parameters:
aAddress- The email address to copy from. May not benull.
-
EmailAddress
Constructor with address only.- Parameters:
sAddress- The email address string. May not benull.
-
EmailAddress
Constructor with address and optional personal name.- Parameters:
sAddress- The email address string. May not benull.sPersonal- The optional personal name. May benull.
-
-
Method Details
-
getAddress
- Specified by:
getAddressin interfaceIEmailAddress- Returns:
- The main email address. May not be
null.
-
getPersonal
- Specified by:
getPersonalin interfaceIEmailAddress- Returns:
- The personal name. May be
null.
-
equals
-
hashCode
public int hashCode() -
toString
-
createOnDemand
Factory method that creates anEmailAddressonly if the provided address is non-empty.- Parameters:
sAddress- The email address string. May benull.- Returns:
nullif the address isnullor empty.
-
createOnDemand
public static @Nullable EmailAddress createOnDemand(@Nullable String sAddress, @Nullable String sPersonal) Factory method that creates anEmailAddressonly if the provided address is non-empty.- Parameters:
sAddress- The email address string. May benull.sPersonal- The optional personal name. May benull.- Returns:
nullif the address isnullor empty.
-