com.upokecenter.mail.NamedAddress

com.upokecenter.mail.NamedAddress

public class NamedAddress extends Object

Represents an email address and a name for that address. Can represent a group of email addresses instead.

Constructors

Methods

Method Details

ToDisplayStringShort

public static String ToDisplayStringShort(List<NamedAddress> addresses)

Generates a string containing the display names of the given named-address objects, separated by commas. The generated string is intended to be displayed to end users, and is not intended to be parsed by computer programs. If a named address has no display name, its email address is used as the display name.

Parameters:

Returns:

Throws:

ToDisplayString

public static String ToDisplayString(List<NamedAddress> addresses)

Generates a string containing the display names and email addresses of the given named-address objects, separated by commas. The generated string is intended to be displayed to end users, and is not intended to be parsed by computer programs.

Parameters:

Returns:

Throws:

ParseAddresses

public static List<NamedAddress> ParseAddresses(String addressValue)

Generates a list of NamedAddress objects from a comma-separated list of addresses. Each address must follow the syntax accepted by the one-argument constructor of NamedAddress.

Parameters:

Returns:

Throws:

hashCode

public int hashCode()

Calculates the hash code of this object. The exact algorithm used by this method is not guaranteed to be the same between versions of this library, and no application or process IDs are used in the hash code calculation.

Overrides:

Returns:

equals

public boolean equals(Object obj)

Determines whether this object and another object are equal. For groups, the named addresses (display name/email address pairs) must be equal and in the same order in both objects.

Overrides:

Parameters:

Returns:

AddressesEqual

public boolean AddressesEqual(NamedAddress na)

Determines whether the email addresses stored this object are the same between this object and the given object, regardless of the display names they store. For groups, the email addresses must be equal and in the same order in both objects.

Parameters:

Returns:

getName

public final String getName()

Gets the display name for this email address, or the email address's value if the display name is null. Returns an empty string if the address and display name are null.

Returns:

getDisplayName

public final String getDisplayName()

Gets the display name for this email address.

Returns:

getAddress

public final Address getAddress()

Gets the email address associated with this object.

Returns:

isGroup

public final boolean isGroup()

Gets a value indicating whether this represents a group of addresses rather than a single address.

Returns:

toString

public String toString()

Converts this object to a text string. This will generally be the form of this NamedAddress object as it could appear in a "To" header field.

Overrides:

Returns:

ToDisplayString

public String ToDisplayString()

Converts this named-address object to a text string intended for display to end users. The returned string is not intended to be parsed by computer programs.

Returns:

getGroupAddresses

public final List<NamedAddress> getGroupAddresses()

Gets a read-only list of addresses that make up the group, if this object represents a group, or an empty list otherwise.

Returns:

Back to MailLib start page.