1 /****************************************************************
\r
2 * Licensed to the Apache Software Foundation (ASF) under one *
\r
3 * or more contributor license agreements. See the NOTICE file *
\r
4 * distributed with this work for additional information *
\r
5 * regarding copyright ownership. The ASF licenses this file *
\r
6 * to you under the Apache License, Version 2.0 (the *
\r
7 * "License"); you may not use this file except in compliance *
\r
8 * with the License. You may obtain a copy of the License at *
\r
10 * http://www.apache.org/licenses/LICENSE-2.0 *
\r
12 * Unless required by applicable law or agreed to in writing, *
\r
13 * software distributed under the License is distributed on an *
\r
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
\r
15 * KIND, either express or implied. See the License for the *
\r
16 * specific language governing permissions and limitations *
\r
17 * under the License. *
\r
18 ****************************************************************/
\r
20 package org.apache.james.mime4j.field.address;
\r
22 import java.util.ArrayList;
\r
25 * A named group of zero or more mailboxes.
\r
29 public class Group extends Address {
\r
30 private String name;
\r
31 private MailboxList mailboxList;
\r
34 * @param name The group name.
\r
35 * @param mailboxes The mailboxes in this group.
\r
37 public Group(String name, MailboxList mailboxes) {
\r
39 this.mailboxList = mailboxes;
\r
43 * Returns the group name.
\r
45 public String getName() {
\r
50 * Returns the mailboxes in this group.
\r
52 public MailboxList getMailboxes() {
\r
56 public String toString() {
\r
57 StringBuffer buf = new StringBuffer();
\r
60 for (int i = 0; i < mailboxList.size(); i++) {
\r
61 buf.append(mailboxList.get(i).toString());
\r
62 if (i + 1 < mailboxList.size())
\r
66 return buf.toString();
\r
69 protected void doAddMailboxesTo(ArrayList results) {
\r
70 for (int i = 0; i < mailboxList.size(); i++)
\r
71 results.add(mailboxList.get(i));
\r