com.hunnysoft.jmime
Class Group

java.lang.Object
  extended bycom.hunnysoft.jmime.Node
      extended bycom.hunnysoft.jmime.FieldBody
          extended bycom.hunnysoft.jmime.Address
              extended bycom.hunnysoft.jmime.Group
All Implemented Interfaces:
java.lang.Cloneable

public class Group
extends Address

Class that represents an RFC 2822 address group.

Group represents a group as described in RFC 2822. A group contains a group name and a (possibly empty) list of mailboxes. In Hunny JMIME, a Group object contains a string for the group name and an AddressList object for the list of mailboxes.

In the document tree representation of a message, a Group object may be only an intermediate node, having both a parent and a single child node. Its parent node should be a Field or an AddressList object. Its child is an AddressList object.


Field Summary
 
Fields inherited from class com.hunnysoft.jmime.Address
mIsValid
 
Fields inherited from class com.hunnysoft.jmime.FieldBody
mText
 
Fields inherited from class com.hunnysoft.jmime.Node
mIsModified, mParent, mString
 
Constructor Summary
Group()
          Default constructor.
Group(ByteString bstr)
          Constructor that takes an initial byte string argument.
Group(Group other)
          Copy constructor.
 
Method Summary
 AddressList addressList()
          Gets a reference to the contained address list
 void assemble()
          Assembles the string representation.
 java.lang.Object clone()
          Creates a copy of this object.
 java.lang.String groupName()
          Gets the group name
 void parse()
          Parses the string representation.
 void setGroupName(java.lang.String name)
          Sets the group name
 
Methods inherited from class com.hunnysoft.jmime.Address
isValid
 
Methods inherited from class com.hunnysoft.jmime.FieldBody
fold, isFoldingEnabled, maybeFold, setFoldingEnabled, setText, text, unfold
 
Methods inherited from class com.hunnysoft.jmime.Node
_setString, isModified, parent, setModified, setParent, setString, string, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Group

public Group()
Default constructor.

This constructor sets the Group object's string representation to the empty string, sets its address list to an empty list, and sets its parent node to null.


Group

public Group(Group other)
Copy constructor.

This constructor performs a deep copy of its argument. The parent node of the new Group object is set to null.

Parameters:
other - Group instance to copy

Group

public Group(ByteString bstr)
Constructor that takes an initial byte string argument.

This constructor sets the Group object's string representation to bstr, sets its address list to an empty list, and sets its parent node to null.

Normally, you call the parse() method immediately after this constructor to create the broken-down representation.

Parameters:
bstr - initial value for the string representation
Method Detail

clone

public java.lang.Object clone()
Creates a copy of this object.

This method, inherited from Object, creates a new Group object that has the same value as this Group object. The parent node of the new Group object is set to null.

Overrides:
clone in class FieldBody
Returns:
a copy of this object

parse

public void parse()
Parses the string representation.

This method, inherited from Node, executes the parse operation for Group objects. The parse operation creates or updates the broken-down representation from the string representation. For Group objects, the parse method parses the string representation to extract the group name and to create an AddressList object from the list of mailboxes. This method also calls the parse() method of the AddressList object it creates.

You should call this method after you set or modify the string representation, and before you retrieve the group name or the address list.

This method clears the is-modified flag.

Overrides:
parse in class FieldBody

assemble

public void assemble()
Assembles the string representation.

This method, inherited from Node, executes the assemble operation for Group objects. The assemble operation creates or updates the string representation from the broken-down representation. For Group objects, the assemble operation builds the string representation from the group name and address list. Before it builds the string representation, this method calls the assemble() method of its contained AddressList object.

You should call this method after you set or modify either the group name or the contained AddressList object, and before you retrieve the string representation.

This method clears the is-modified flag.

Overrides:
assemble in class FieldBody

groupName

public java.lang.String groupName()
Gets the group name

Returns:
group name

setGroupName

public void setGroupName(java.lang.String name)
Sets the group name

Parameters:
name - group name

addressList

public AddressList addressList()
Gets a reference to the contained address list

Returns:
reference to the address list