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

java.lang.Object
  extended by org.apache.james.mime4j.field.address.Address
      extended by org.apache.james.mime4j.field.address.Group
All Implemented Interfaces:
java.io.Serializable

public class Group
extends Address

A named group of zero or more mailboxes.

See Also:
Serialized Form

Constructor Summary
Group(java.lang.String name, java.util.Collection<Mailbox> mailboxes)
           
Group(java.lang.String name, Mailbox... mailboxes)
           
Group(java.lang.String name, MailboxList mailboxes)
           
 
Method Summary
protected  void doAddMailboxesTo(java.util.List<Mailbox> results)
          Adds any mailboxes represented by this address into the given List.
 java.lang.String getDisplayString(boolean includeRoute)
          Formats the address as a human readable string, not including the route.
 java.lang.String getEncodedString()
          Returns a string representation of this address that can be used for transport purposes.
 MailboxList getMailboxes()
          Returns the mailboxes in this group.
 java.lang.String getName()
          Returns the group name.
static Group parse(java.lang.String rawGroupString)
          Parses the specified raw string into a group address.
 
Methods inherited from class org.apache.james.mime4j.field.address.Address
getDisplayString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Group

public Group(java.lang.String name,
             Mailbox... mailboxes)
Parameters:
name - The group name.
mailboxes - The mailboxes in this group.

Group

public Group(java.lang.String name,
             java.util.Collection<Mailbox> mailboxes)
Parameters:
name - The group name.
mailboxes - The mailboxes in this group.

Group

public Group(java.lang.String name,
             MailboxList mailboxes)
Parameters:
name - The group name.
mailboxes - The mailboxes in this group.
Method Detail

parse

public static Group parse(java.lang.String rawGroupString)
Parses the specified raw string into a group address.

Parameters:
rawGroupString - string to parse.
Returns:
a Group object for the specified string.
Throws:
java.lang.IllegalArgumentException - if the raw string does not represent a single group address.

getName

public java.lang.String getName()
Returns the group name.


getMailboxes

public MailboxList getMailboxes()
Returns the mailboxes in this group.


getDisplayString

public java.lang.String getDisplayString(boolean includeRoute)
Description copied from class: Address
Formats the address as a human readable string, not including the route. The resulting string is intended for display purposes only and cannot be used for transport 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.

Specified by:
getDisplayString in class Address
Parameters:
includeRoute - true if the route should be included if it exists, false otherwise.
Returns:
a string representation of this address intended to be displayed.

getEncodedString

public java.lang.String getEncodedString()
Description copied from class: Address
Returns a string representation of this address that can be used for transport purposes. The route is never included in this representation because routes are obsolete and RFC 5322 states that obsolete syntactic forms MUST NOT be generated.

Specified by:
getEncodedString in class Address
Returns:
a string representation of this address intended for transport purposes.

doAddMailboxesTo

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

Specified by:
doAddMailboxesTo in class Address


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