org.apache.james.mime4j.field.address
Class Mailbox

java.lang.Object
  extended by org.apache.james.mime4j.field.address.Address
      extended by org.apache.james.mime4j.field.address.Mailbox
Direct Known Subclasses:
NamedMailbox

public class Mailbox
extends Address

Represents a single e-mail address.


Constructor Summary
Mailbox(DomainList route, java.lang.String localPart, java.lang.String domain)
          Creates a mailbox with a route.
Mailbox(java.lang.String localPart, java.lang.String domain)
          Creates a mailbox without a route.
 
Method Summary
protected  void doAddMailboxesTo(java.util.ArrayList results)
          Adds any mailboxes represented by this address into the given ArrayList.
 java.lang.String getAddressString()
          Formats the address as a string, not including the route.
 java.lang.String getAddressString(boolean includeRoute)
          Note that this value may not be usable for transport purposes, only display purposes.
 java.lang.String getDomain()
          Returns the right part of the e-mail address (after "@").
 java.lang.String getLocalPart()
          Returns the left part of the e-mail address (before "@").
 DomainList getRoute()
          Returns the route list.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Mailbox

public Mailbox(java.lang.String localPart,
               java.lang.String domain)
Creates a mailbox without a route. Routes are obsolete.

Parameters:
localPart - The part of the e-mail address to the left of the "@".
domain - The part of the e-mail address to the right of the "@".

Mailbox

public Mailbox(DomainList route,
               java.lang.String localPart,
               java.lang.String domain)
Creates a mailbox with a route. Routes are obsolete.

Parameters:
route - The zero or more domains that make up the route. Can be null.
localPart - The part of the e-mail address to the left of the "@".
domain - The part of the e-mail address to the right of the "@".
Method Detail

getRoute

public DomainList getRoute()
Returns the route list.


getLocalPart

public java.lang.String getLocalPart()
Returns the left part of the e-mail address (before "@").


getDomain

public java.lang.String getDomain()
Returns the right part of the e-mail address (after "@").


getAddressString

public java.lang.String getAddressString()
Formats the address as a string, not including the route.

See Also:
getAddressString(boolean)

getAddressString

public java.lang.String getAddressString(boolean includeRoute)
Note that this value may not be usable for transport purposes, only display purposes. For example, if the unparsed address was <"Joe Cheng"@joecheng.com> this method would return which is not valid for transport; the local part would need to be re-quoted.

Parameters:
includeRoute - true if the route should be included if it exists.

doAddMailboxesTo

protected final void doAddMailboxesTo(java.util.ArrayList results)
Description copied from class: Address
Adds any mailboxes represented by this address into the given ArrayList. Must be overridden by concrete subclasses.

Specified by:
doAddMailboxesTo in class Address

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.