1 21 22 27 28 package javax.mail; 29 30 import java.util.Vector ; 31 32 70 71 public class FetchProfile { 72 73 private Vector specials; private Vector headers; 76 89 90 public static class Item { 91 103 public static final Item ENVELOPE = new Item("ENVELOPE"); 104 105 115 public static final Item CONTENT_INFO = new Item("CONTENT_INFO"); 116 117 120 public static final Item FLAGS = new Item("FLAGS"); 121 122 private String name; 123 124 127 protected Item(String name) { 128 this.name = name; 129 } 130 } 131 132 135 public FetchProfile() { 136 specials = null; 137 headers = null; 138 } 139 140 149 public void add(Item item) { 150 if (specials == null) 151 specials = new Vector (); 152 specials.addElement(item); 153 } 154 155 161 public void add(String headerName) { 162 if (headers == null) 163 headers = new Vector (); 164 headers.addElement(headerName); 165 } 166 167 170 public boolean contains(Item item) { 171 return specials != null && specials.contains(item); 172 } 173 174 177 public boolean contains(String headerName) { 178 return headers != null && headers.contains(headerName); 179 } 180 181 186 public Item[] getItems() { 187 if (specials == null) 188 return new Item[0]; 189 190 Item[] s = new Item[specials.size()]; 191 specials.copyInto(s); 192 return s; 193 } 194 195 200 public String [] getHeaderNames() { 201 if (headers == null) 202 return new String [0]; 203 204 String [] s = new String [headers.size()]; 205 headers.copyInto(s); 206 return s; 207 } 208 } 209 | Popular Tags |