com.funambol.mail
Class Address

java.lang.Object
  extended by com.funambol.mail.Address

public class Address
extends java.lang.Object

A class describing the RFC 2822 address specification as per § 3.4


Field Summary
static int BCC
           
static int CC
           
static int FROM
           
static int REPLYTO
           
static int TO
           
 
Constructor Summary
Address(int type, java.lang.String address)
          Creates a new instance of Address, parsing address to
Address(int type, java.lang.String name, java.lang.String address)
          Creates a new instance of Address
 
Method Summary
 java.lang.String getEmail()
          Returns the email address
 java.lang.String getName()
          Returns the visible name TODO: or the address if null?
 int getType()
          Returns the type of address
 java.lang.String getVisibleName()
          Returns the name or the address if name is empy
static Address[] parse(int type, java.lang.String addresslist)
          Parses an address list and return an array of Address objects, each representing a recipient.
 void setEmail(java.lang.String email)
          Set the email address
 void setName(java.lang.String name)
          Set the visible name
 void setType(int type)
          Set the type of address
 java.lang.String toString()
          Returns the string representation of the Address, in RFC2822 format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FROM

public static final int FROM
See Also:
Constant Field Values

TO

public static final int TO
See Also:
Constant Field Values

CC

public static final int CC
See Also:
Constant Field Values

BCC

public static final int BCC
See Also:
Constant Field Values

REPLYTO

public static final int REPLYTO
See Also:
Constant Field Values
Constructor Detail

Address

public Address(int type,
               java.lang.String address)
        throws MailException
Creates a new instance of Address, parsing address to

Throws:
MailException

Address

public Address(int type,
               java.lang.String name,
               java.lang.String address)
        throws MailException
Creates a new instance of Address

Throws:
MailException
Method Detail

getType

public int getType()
Returns the type of address


getVisibleName

public java.lang.String getVisibleName()
Returns the name or the address if name is empy


getName

public java.lang.String getName()
Returns the visible name TODO: or the address if null?


getEmail

public java.lang.String getEmail()
Returns the email address


setType

public void setType(int type)
Set the type of address


setName

public void setName(java.lang.String name)
Set the visible name


setEmail

public void setEmail(java.lang.String email)
              throws MailException
Set the email address

Throws:
MailException

parse

public static Address[] parse(int type,
                              java.lang.String addresslist)
                       throws MailException
Parses an address list and return an array of Address objects, each representing a recipient. Use: Address [] list = Address.parse( Address.TO, "John Doe<john.doe@mail.com>"

Parameters:
addresslist - the comma separated list of addresses
Returns:
an array of Address containing the result, or an empty array if addresslist is empty
Throws:
MailException - if the address is malformed TODO: Improve the Parser: now a visible name like: "Mario Rossi, Funambol Inc" breaks it.

toString

public java.lang.String toString()
Returns the string representation of the Address, in RFC2822 format.

Overrides:
toString in class java.lang.Object


Copyright © 2006 Funambol.