public class Address extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<Address>
Constructor and Description |
---|
Address(java.lang.String mailAddress)
Construct a Address with a valid mail address that must not be parsed.
|
Address(java.lang.String displayName,
java.lang.String mailAddress)
Contruct a Address with a valid mail address and a displayname.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Address arg0) |
boolean |
equals(java.lang.Object arg0) |
java.lang.String |
getCanonicalMailAddress()
Get the canonical form of the mailaddress.
|
java.lang.String |
getDisplayName()
Gets the displayname.
|
java.lang.String |
getMailAddress()
Gets the mail address.
|
java.lang.String |
getShortAddress()
Gets the short form of the address.
|
int |
hashCode() |
static Address |
parse(java.lang.CharSequence source)
Uses the
AddressParser to parse the CharSequence. |
void |
setDisplayName(java.lang.String displayName)
Sets the displayname.
|
java.lang.String |
toString() |
public Address(java.lang.String mailAddress)
Note: If you want to parse an Address from a String use the
static
parse(CharSequence)
instead.
mailAddress
- a valid mail address (e.g. my@mail.org).public Address(java.lang.String displayName, java.lang.String mailAddress)
Note: If you want to parse an Address from a String use the
static
parse(CharSequence)
instead.
displayName
- the name to display for this address, i.e. the real name (e.g.
Timo Stich).mailAddress
- A valid mail address (e.g. my@mail.org).public java.lang.String getDisplayName()
Example: "Timo Stich"
null
if
not set.public java.lang.String getMailAddress()
Example: my@mail.org
public java.lang.String getCanonicalMailAddress()
Example: <my@mail.org>
public java.lang.String getShortAddress()
Examples: "Timo Stich" or "my@mail.org"
public void setDisplayName(java.lang.String displayName)
Example: "Timo Stich"
displayName
- the human readable representation of the address.public boolean equals(java.lang.Object arg0)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int compareTo(Address arg0)
compareTo
in interface java.lang.Comparable<Address>
Comparable.compareTo(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public static Address parse(java.lang.CharSequence source) throws ParserException
AddressParser
to parse the CharSequence.source
- the address that is parsed, e.g.
"Timo Stich <my@mail.org>"ParserException
Copyright © 2021. All Rights Reserved.