|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jcoderz.commons.types.EmailAddress
public class EmailAddress
This class represents an email addresses compliant to RFC 2822, chapter 3.4.1. Addr-spec specification. This class does not support obsolete addressing (see ch. 4.4. Obsolete Addressing).
atext = ALPHA / DIGIT / ; Any character except controls,
"!" / "#" / ; SP, and specials.
"$" / "%" / ; Used for atoms
"&" / "'" /
"*" / "+" /
"-" / "/" /
"=" / "?" /
"^" / "_" /
"`" / "{" /
"|" / "}" /
"~"
atom = [CFWS] 1*atext [CFWS]
dot-atom = [CFWS] dot-atom-text [CFWS]
dot-atom-text = 1*atext *("." 1*atext)
addr-spec = local-part "@" domain
local-part = dot-atom / quoted-string
qtext = NO-WS-CTL / ; Non white space controls
%d33 / ; The rest of the US-ASCII
%d35-91 / ; characters not including "\"
%d93-126 ; or the quote character
qcontent = qtext / quoted-pair
quoted-string = [CFWS]
DQUOTE *([FWS] qcontent) [FWS] DQUOTE
[CFWS]
domain = dot-atom / domain-literal
domain-literal = [CFWS] "[" *([FWS] dcontent) [FWS] "]" [CFWS]
dcontent = dtext / quoted-pair
dtext = NO-WS-CTL / ; Non white space controls
%d33-90 / ; The rest of the US-ASCII
%d94-126 ; characters not including "[",
; "]", or "\"
FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space
obs-FWS
ctext = NO-WS-CTL / ; Non white space controls
%d33-39 / ; The rest of the US-ASCII
%d42-91 / ; characters not including "(",
%d93-126 ; ")", or "\"
ccontent = ctext / quoted-pair / comment
comment = "(" *([FWS] ccontent) [FWS] ")"
CFWS = *([FWS] comment) (([FWS] comment) / FWS)
The maximum length of an email address is: 64+1+255 characters (local-part + @ + domain). The minimum length of an email address is: 1+1+4 characters (local-part + @ + domain).
A valid list of top-level domains is defined by the IANA. A top-level domain which is not part of the official list will be rejected.
| Constructor Summary | |
|---|---|
EmailAddress(String email)
This is the constructor of the EmailAddress type. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
Returns the true if this email address equals the other. |
static EmailAddress |
fromString(String email)
Factory method for converting a String into an instance of type EmailAddress. |
String |
getAddress()
Returns the full email address. |
String |
getDomain()
Returns the domain name of the address. |
String |
getName()
Returns the local part of the address. |
String |
getTopLevelDomain()
Returns the top-level domain name of the address. |
int |
hashCode()
Returns the hash code for this email. |
String |
toString()
Returns the full email address. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EmailAddress(String email)
email - The email address.| Method Detail |
|---|
public static EmailAddress fromString(String email)
email - the email address to parse
public String getName()
public String getDomain()
public String getTopLevelDomain()
public String getAddress()
public String toString()
toString in class Objectpublic boolean equals(Object obj)
equals in class Objectobj - the object to compare to.
Object.equals(java.lang.Object)public int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||