java.lang.Object
com.aoapps.net.Email
- All Implemented Interfaces:
DtoFactory<Email>,FastExternalizable,Internable<Email>,Externalizable,Serializable,Comparable<Email>,SQLData
public final class Email
extends Object
implements Comparable<Email>, FastExternalizable, DtoFactory<Email>, Internable<Email>, SQLData
Represents an email address. Email addresses must:
- Be non-null
- Be non-empty
- Contain a single @, but not at the beginning or end
- Local part must adhere to RFC 5322.
- Author:
- AO Industries, Inc.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintSorts by domain and then by local part.booleangetDto()longinthashCode()intern()Interns this email much in the same fashion asString.intern().voidvoidtoString()static ValidationResultValidates a complete email address.static ValidationResultvalidate(String localPart, DomainName domain) Validates the local part of the email address (before the @ symbol), as well as additional domain rules.static ValidationResultValidates the local part of the email address (before the @ symbol), as well as additional domain rules.static Emailstatic EmailvalueOf(String localPart, DomainName domain) voidvoid
-
Field Details
-
MAX_LENGTH
public static final int MAX_LENGTH- See Also:
-
MAX_LOCAL_PART_LENGTH
public static final int MAX_LOCAL_PART_LENGTH- See Also:
-
SQL_TYPE
- See Also:
-
-
Constructor Details
-
Email
Deprecated.Only required for implementation, do not use directly.- See Also:
-
-
Method Details
-
validate
Validates a complete email address. Splits on @ and callsvalidateon local part and domain.- See Also:
-
validate
Validates the local part of the email address (before the @ symbol), as well as additional domain rules. -
validate
Validates the local part of the email address (before the @ symbol), as well as additional domain rules. -
valueOf
- Parameters:
email- whennull, returnsnull- Throws:
ValidationException- See Also:
-
valueOf
- Throws:
ValidationException
-
equals
-
hashCode
public int hashCode() -
compareTo
Sorts by domain and then by local part.- Specified by:
compareToin interfaceComparable<Email>
-
toString
-
intern
Interns this email much in the same fashion asString.intern().- Specified by:
internin interfaceInternable<Email>- See Also:
-
getLocalPart
-
getDomain
-
getDto
- Specified by:
getDtoin interfaceDtoFactory<Email>
-
getSerialVersionUID
public long getSerialVersionUID()- Specified by:
getSerialVersionUIDin interfaceFastExternalizable
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
getSQLTypeName
- Specified by:
getSQLTypeNamein interfaceSQLData
-
writeSQL
- Specified by:
writeSQLin interfaceSQLData- Throws:
SQLException
-
readSQL
- Specified by:
readSQLin interfaceSQLData- Throws:
SQLException
-
