14fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy/****************************************************************
24fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * Licensed to the Apache Software Foundation (ASF) under one   *
34fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * or more contributor license agreements.  See the NOTICE file *
44fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * distributed with this work for additional information        *
54fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * regarding copyright ownership.  The ASF licenses this file   *
64fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * to you under the Apache License, Version 2.0 (the            *
74fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * "License"); you may not use this file except in compliance   *
84fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * with the License.  You may obtain a copy of the License at   *
94fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy *                                                              *
104fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy *   http://www.apache.org/licenses/LICENSE-2.0                 *
114fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy *                                                              *
124fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * Unless required by applicable law or agreed to in writing,   *
134fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * software distributed under the License is distributed on an  *
144fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
154fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * KIND, either express or implied.  See the License for the    *
164fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * specific language governing permissions and limitations      *
174fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * under the License.                                           *
184fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy ****************************************************************/
194fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
204fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedypackage org.apache.james.mime4j.field;
214fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
224fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedyimport org.apache.james.mime4j.decoder.DecoderUtil;
234fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
244fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
254fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy/**
264fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * Simple unstructured field such as <code>Subject</code>.
274fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy *
284fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy *
294fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * @version $Id: UnstructuredField.java,v 1.3 2004/10/25 07:26:46 ntherning Exp $
304fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy */
314fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedypublic class UnstructuredField extends Field {
324fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    private String value;
334fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
344fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    protected UnstructuredField(String name, String body, String raw, String value) {
354fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        super(name, body, raw);
364fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        this.value = value;
374fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    }
384fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
394fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    public String getValue() {
404fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        return value;
414fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    }
424fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
434fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    public static class Parser implements FieldParser {
444fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        public Field parse(final String name, final String body, final String raw) {
454fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy            final String value = DecoderUtil.decodeEncodedWords(body);
464fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy            return new UnstructuredField(name, body, raw, value);
474fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        }
484fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    }
494fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy}
50