001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package org.apache.geronimo.javamail.store.imap.connection; 019 020 import javax.mail.internet.MailDateFormat; 021 022 public class IMAPFetchDataItem { 023 public static final int FETCH = 0; 024 public static final int ENVELOPE = 1; 025 public static final int BODY = 2; 026 public static final int BODYSTRUCTURE = 3; 027 public static final int INTERNALDATE = 4; 028 public static final int SIZE = 5; 029 public static final int UID = 6; 030 public static final int TEXT = 7; 031 public static final int HEADER = 8; 032 public static final int FLAGS = 9; 033 034 // the type of the FETCH response item. 035 protected int type; 036 037 public IMAPFetchDataItem(int type) { 038 this.type = type; 039 } 040 041 /** 042 * Get the type of the FetchResponse. 043 * 044 * @return The type indicator. 045 */ 046 public int getType() { 047 return type; 048 } 049 050 /** 051 * Test if this fetch response is of the correct type. 052 * 053 * @param t The type to test against. 054 * 055 * @return True if the Fetch response contains the requested type information. 056 */ 057 public boolean isType(int t) { 058 return type == t; 059 } 060 } 061