1 /*
2 * Copyright (c) 2004-2007 Creative Sphere Limited.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *
10 * Creative Sphere - initial API and implementation
11 *
12 */
13 package org.abstracthorizon.mercury.imap.util.section;
14
15 import java.util.List;
16
17 import org.abstracthorizon.mercury.imap.util.Section;
18
19 /**
20 * Header section
21 *
22 * @author Daniel Sendula
23 */
24 public class HeaderSection extends Section {
25
26 /** All keyword is recognised */
27 public boolean all = true;
28
29 /** Not keyword is recognised */
30 public boolean not = false;
31
32 /** List of fields */
33 public List<String> fields = null;
34
35 public String headerFields() {
36 StringBuffer b = new StringBuffer();
37 return b.toString();
38 }
39
40 /**
41 * Returns string representation of this object
42 * @return string representation of this object
43 */
44 public String toString() {
45 StringBuffer b = new StringBuffer();
46 b.append("HEADER");
47 if (!all) {
48 b.append(".FIELDS");
49 if (not) {
50 b.append(".NOT");
51 }
52 }
53 if ((fields != null) && (fields.size() > 0)) {
54 b.append(" (");
55 for (int i=0; i<fields.size(); i++) {
56 if (i > 0) {
57 b.append(' ');
58 }
59 b.append('"').append(fields.get(i).toString()).append('"');
60 } // for
61 b.append(')');
62 }
63 return b.toString();
64 }
65 }