001package ezvcard.parameter;
002
003import static ezvcard.VCardVersion.V2_1;
004import static ezvcard.VCardVersion.V3_0;
005import static ezvcard.VCardVersion.V4_0;
006
007import java.util.Collection;
008
009import ezvcard.SupportedVersions;
010import ezvcard.property.Email;
011
012/*
013 Copyright (c) 2012-2023, Michael Angstadt
014 All rights reserved.
015
016 Redistribution and use in source and binary forms, with or without
017 modification, are permitted provided that the following conditions are met: 
018
019 1. Redistributions of source code must retain the above copyright notice, this
020 list of conditions and the following disclaimer. 
021 2. Redistributions in binary form must reproduce the above copyright notice,
022 this list of conditions and the following disclaimer in the documentation
023 and/or other materials provided with the distribution. 
024
025 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
026 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
027 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
028 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
029 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
030 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
031 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
032 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
033 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
034 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
035
036 The views and conclusions contained in the software and documentation are those
037 of the authors and should not be interpreted as representing official policies, 
038 either expressed or implied, of the FreeBSD Project.
039 */
040
041/**
042 * Represents the TYPE parameter of the {@link Email} properties.
043 * <p>
044 * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0}
045 * </p>
046 * @author Michael Angstadt
047 */
048public class EmailType extends VCardParameter {
049        private static final VCardParameterCaseClasses<EmailType> enums = new VCardParameterCaseClasses<>(EmailType.class);
050
051        @SupportedVersions({ V2_1, V3_0 })
052        public static final EmailType INTERNET = new EmailType("internet");
053
054        @SupportedVersions({ V2_1, V3_0 })
055        public static final EmailType X400 = new EmailType("x400");
056
057        @SupportedVersions({ V2_1, V3_0 })
058        public static final EmailType PREF = new EmailType("pref");
059
060        @SupportedVersions(V2_1)
061        public static final EmailType AOL = new EmailType("aol");
062
063        @SupportedVersions(V2_1)
064        public static final EmailType APPLELINK = new EmailType("applelink");
065
066        @SupportedVersions(V2_1)
067        public static final EmailType ATTMAIL = new EmailType("attmail");
068
069        @SupportedVersions(V2_1)
070        public static final EmailType CIS = new EmailType("cis");
071
072        @SupportedVersions(V2_1)
073        public static final EmailType EWORLD = new EmailType("eworld");
074
075        @SupportedVersions(V2_1)
076        public static final EmailType IBMMAIL = new EmailType("ibmmail");
077
078        @SupportedVersions(V2_1)
079        public static final EmailType MCIMAIL = new EmailType("mcimail");
080
081        @SupportedVersions(V2_1)
082        public static final EmailType POWERSHARE = new EmailType("powershare");
083
084        @SupportedVersions(V2_1)
085        public static final EmailType PRODIGY = new EmailType("prodigy");
086
087        @SupportedVersions(V2_1)
088        public static final EmailType TLX = new EmailType("tlx");
089
090        @SupportedVersions(V4_0)
091        public static final EmailType HOME = new EmailType("home");
092
093        @SupportedVersions(V4_0)
094        public static final EmailType WORK = new EmailType("work");
095
096        private EmailType(String value) {
097                super(value);
098        }
099
100        /**
101         * Searches for a parameter value that is defined as a static constant in
102         * this class.
103         * @param value the parameter value
104         * @return the object or null if not found
105         */
106        public static EmailType find(String value) {
107                return enums.find(value);
108        }
109
110        /**
111         * Searches for a parameter value and creates one if it cannot be found. All
112         * objects are guaranteed to be unique, so they can be compared with
113         * {@code ==} equality.
114         * @param value the parameter value
115         * @return the object
116         */
117        public static EmailType get(String value) {
118                return enums.get(value);
119        }
120
121        /**
122         * Gets all of the parameter values that are defined as static constants in
123         * this class.
124         * @return the parameter values
125         */
126        public static Collection<EmailType> all() {
127                return enums.all();
128        }
129}