View Javadoc

1   /****************************************************************
2    * Licensed to the Apache Software Foundation (ASF) under one   *
3    * or more contributor license agreements.  See the NOTICE file *
4    * distributed with this work for additional information        *
5    * regarding copyright ownership.  The ASF licenses this file   *
6    * to you under the Apache License, Version 2.0 (the            *
7    * "License"); you may not use this file except in compliance   *
8    * with the License.  You may obtain a copy of the License at   *
9    *                                                              *
10   *   http://www.apache.org/licenses/LICENSE-2.0                 *
11   *                                                              *
12   * Unless required by applicable law or agreed to in writing,   *
13   * software distributed under the License is distributed on an  *
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
15   * KIND, either express or implied.  See the License for the    *
16   * specific language governing permissions and limitations      *
17   * under the License.                                           *
18   ****************************************************************/
19  
20  package org.apache.james.mime4j.field;
21  
22  public class DefaultFieldParser extends DelegatingFieldParser {
23  
24      public DefaultFieldParser() {
25          setFieldParser(FieldName.CONTENT_TRANSFER_ENCODING,
26                  ContentTransferEncodingField.PARSER);
27          setFieldParser(FieldName.CONTENT_TYPE, ContentTypeField.PARSER);
28          setFieldParser(FieldName.CONTENT_DISPOSITION,
29                  ContentDispositionField.PARSER);
30  
31          final FieldParser dateTimeParser = DateTimeField.PARSER;
32          setFieldParser(FieldName.DATE, dateTimeParser);
33          setFieldParser(FieldName.RESENT_DATE, dateTimeParser);
34  
35          final FieldParser mailboxListParser = MailboxListField.PARSER;
36          setFieldParser(FieldName.FROM, mailboxListParser);
37          setFieldParser(FieldName.RESENT_FROM, mailboxListParser);
38  
39          final FieldParser mailboxParser = MailboxField.PARSER;
40          setFieldParser(FieldName.SENDER, mailboxParser);
41          setFieldParser(FieldName.RESENT_SENDER, mailboxParser);
42  
43          final FieldParser addressListParser = AddressListField.PARSER;
44          setFieldParser(FieldName.TO, addressListParser);
45          setFieldParser(FieldName.RESENT_TO, addressListParser);
46          setFieldParser(FieldName.CC, addressListParser);
47          setFieldParser(FieldName.RESENT_CC, addressListParser);
48          setFieldParser(FieldName.BCC, addressListParser);
49          setFieldParser(FieldName.RESENT_BCC, addressListParser);
50          setFieldParser(FieldName.REPLY_TO, addressListParser);
51      }
52  
53  }