Clover coverage report - Maven Clover report
Coverage timestamp: Sun Aug 20 2006 04:01:04 PDT
file stats: LOC: 122   Methods: 7
NCLOC: 32   Classes: 2
 
 Source file Conditionals Statements Methods TOTAL
FetchProfile.java - 0% 0% 0%
coverage
 1    /**
 2    *
 3    * Copyright 2003-2004 The Apache Software Foundation
 4    *
 5    * Licensed under the Apache License, Version 2.0 (the "License");
 6    * you may not use this file except in compliance with the License.
 7    * You may obtain a copy of the License at
 8    *
 9    * http://www.apache.org/licenses/LICENSE-2.0
 10    *
 11    * Unless required by applicable law or agreed to in writing, software
 12    * distributed under the License is distributed on an "AS IS" BASIS,
 13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14    * See the License for the specific language governing permissions and
 15    * limitations under the License.
 16    */
 17   
 18    package javax.mail;
 19   
 20    import java.util.ArrayList;
 21    import java.util.List;
 22   
 23    /**
 24    * A FetchProfile defines a list of message attributes that a client wishes to prefetch
 25    * from the server during a fetch operation.
 26    *
 27    * Clients can either specify individual headers, or can reference common profiles
 28    * as defined by {@link FetchProfile.Item FetchProfile.Item}.
 29    *
 30    * @version $Rev: 125583 $ $Date: 2005-01-18 19:44:27 -0800 (Tue, 18 Jan 2005) $
 31    */
 32    public class FetchProfile {
 33    /**
 34    * Inner class that defines sets of headers that are commonly bundled together
 35    * in a FetchProfile.
 36    */
 37    public static class Item {
 38    /**
 39    * Item for fetching information about the content of the message.
 40    *
 41    * This includes all the headers about the content including but not limited to:
 42    * Content-Type, Content-Disposition, Content-Description, Size and Line-Count
 43    */
 44    public static final Item CONTENT_INFO = new Item("Content-Info");
 45   
 46    /**
 47    * Item for fetching information about the envelope of the message.
 48    *
 49    * This includes all the headers comprising the envelope including but not limited to:
 50    * From, To, Cc, Bcc, Reply-To, Subject and Date
 51    *
 52    * For IMAP4, this should also include the ENVELOPE data item.
 53    *
 54    */
 55    public static final Item ENVELOPE = new Item("Envelope");
 56   
 57    /**
 58    * Item for fetching information about message flags.
 59    * Generall corresponds to the X-Flags header.
 60    */
 61    public static final Item FLAGS = new Item("Flags");
 62   
 63  0 protected Item(String name) {
 64    // hmmm, name is passed in but we are not allowed to provide accessors
 65    // or to override equals/hashCode so what use is it?
 66    }
 67    }
 68   
 69    // use Lists as we don't expect contains to be called often and the number of elements should be small
 70    private final List items = new ArrayList();
 71    private final List headers = new ArrayList();
 72   
 73    /**
 74    * Add a predefined profile of headers.
 75    *
 76    * @param item the profile to add
 77    */
 78  0 public void add(Item item) {
 79  0 items.add(item);
 80    }
 81   
 82    /**
 83    * Add a specific header.
 84    * @param header the header whose value should be prefetched
 85    */
 86  0 public void add(String header) {
 87  0 headers.add(header);
 88    }
 89   
 90    /**
 91    * Determine if the given profile item is already included.
 92    * @param item the profile to check for
 93    * @return true if the profile item is already included
 94    */
 95  0 public boolean contains(Item item) {
 96  0 return items.contains(item);
 97    }
 98   
 99    /**
 100    * Determine if the specified header is already included.
 101    * @param header the header to check for
 102    * @return true if the header is already included
 103    */
 104  0 public boolean contains(String header) {
 105  0 return headers.contains(header);
 106    }
 107   
 108    /**
 109    * Get the profile items already included.
 110    * @return the items already added to this profile
 111    */
 112  0 public Item[] getItems() {
 113  0 return (Item[]) items.toArray(new Item[items.size()]);
 114    }
 115   
 116    /** Get the headers that have already been included.
 117    * @return the headers already added to this profile
 118    */
 119  0 public String[] getHeaderNames() {
 120  0 return (String[]) headers.toArray(new String[headers.size()]);
 121    }
 122    }