001    package ezvcard.parameters;
002    
003    /**
004     * Copyright 2011 George El-Haddad. All rights reserved.
005     * 
006     * Redistribution and use in source and binary forms, with or without modification, are
007     * permitted provided that the following conditions are met:
008     * 
009     *    1. Redistributions of source code must retain the above copyright notice, this list of
010     *       conditions and the following disclaimer.
011     * 
012     *    2. Redistributions in binary form must reproduce the above copyright notice, this list
013     *       of conditions and the following disclaimer in the documentation and/or other materials
014     *       provided with the distribution.
015     * 
016     * THIS SOFTWARE IS PROVIDED BY GEORGE EL-HADDAD ''AS IS'' AND ANY EXPRESS OR IMPLIED
017     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
018     * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GEORGE EL-HADDAD OR
019     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
020     * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
021     * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
022     * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
023     * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
024     * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
025     * 
026     * The views and conclusions contained in the software and documentation are those of the
027     * authors and should not be interpreted as representing official policies, either expressed
028     * or implied, of George El-Haddad.
029     */
030    
031    /*
032     Copyright (c) 2012, Michael Angstadt
033     All rights reserved.
034    
035     Redistribution and use in source and binary forms, with or without
036     modification, are permitted provided that the following conditions are met: 
037    
038     1. Redistributions of source code must retain the above copyright notice, this
039     list of conditions and the following disclaimer. 
040     2. Redistributions in binary form must reproduce the above copyright notice,
041     this list of conditions and the following disclaimer in the documentation
042     and/or other materials provided with the distribution. 
043    
044     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
045     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
046     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
047     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
048     ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
049     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
050     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
051     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
052     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
053     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
054    
055     The views and conclusions contained in the software and documentation are those
056     of the authors and should not be interpreted as representing official policies, 
057     either expressed or implied, of the FreeBSD Project.
058     */
059    
060    /**
061     * Represents the "ENCODING" sub type.
062     * <p>
063     * vCard versions: 2.1, 3.0
064     * </p>
065     * @author George El-Haddad Mar 10, 2010
066     * @author Michael Angstadt
067     */
068    public class EncodingParameter extends VCardParameter {
069            public static final String NAME = "ENCODING";
070    
071            /**
072             * vCard versions: 2.1
073             */
074            public static final EncodingParameter QUOTED_PRINTABLE = new EncodingParameter("quoted-printable");
075    
076            /**
077             * vCard versions: 2.1
078             */
079            public static final EncodingParameter BASE64 = new EncodingParameter("base64");
080    
081            /**
082             * vCard versions: 2.1
083             */
084            public static final EncodingParameter _8BIT = new EncodingParameter("8bit");
085    
086            /**
087             * vCard versions: 2.1
088             */
089            public static final EncodingParameter _7BIT = new EncodingParameter("7bit");
090    
091            /**
092             * vCard versions: 3.0
093             */
094            public static final EncodingParameter B = new EncodingParameter("b");
095    
096            /**
097             * Use of this constructor is discouraged and should only be used for
098             * defining non-standard ENCODINGs. Please use one of the predefined static
099             * objects.
100             * @param value the type value (e.g. "b")
101             */
102            public EncodingParameter(String value) {
103                    super(NAME, value);
104            }
105    
106            /**
107             * Searches the static objects in this class for one that has a certain type
108             * value.
109             * @param value the type value to search for (e.g. "b")
110             * @return the object or null if not found
111             */
112            public static EncodingParameter valueOf(String value) {
113                    return findByValue(value, EncodingParameter.class);
114            }
115    }