001 package ezvcard.parameter;
002
003 import java.util.Collection;
004
005 import ezvcard.VCardVersion;
006 import ezvcard.property.Telephone;
007
008 /*
009 Copyright (c) 2013, Michael Angstadt
010 All rights reserved.
011
012 Redistribution and use in source and binary forms, with or without
013 modification, are permitted provided that the following conditions are met:
014
015 1. Redistributions of source code must retain the above copyright notice, this
016 list of conditions and the following disclaimer.
017 2. Redistributions in binary form must reproduce the above copyright notice,
018 this list of conditions and the following disclaimer in the documentation
019 and/or other materials provided with the distribution.
020
021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
024 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
025 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
026 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
027 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
028 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
029 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
030 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031
032 The views and conclusions contained in the software and documentation are those
033 of the authors and should not be interpreted as representing official policies,
034 either expressed or implied, of the FreeBSD Project.
035 */
036
037 /**
038 * Represents the TYPE parameter of the {@link Telephone} property.
039 * <p>
040 * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0}
041 * </p>
042 * @author Michael Angstadt
043 */
044 public class TelephoneType extends VersionedVCardParameter {
045 private static final VCardParameterCaseClasses<TelephoneType> enums = new VCardParameterCaseClasses<TelephoneType>(TelephoneType.class);
046
047 /**
048 * <b>Supported versions:</b> {@code 2.1, 3.0}
049 */
050 public static final TelephoneType BBS = new TelephoneType("bbs", VCardVersion.V2_1, VCardVersion.V3_0);
051
052 /**
053 * <b>Supported versions:</b> {@code 2.1, 3.0}
054 */
055 public static final TelephoneType CAR = new TelephoneType("car", VCardVersion.V2_1, VCardVersion.V3_0);
056
057 /**
058 * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0}
059 */
060 public static final TelephoneType CELL = new TelephoneType("cell");
061
062 /**
063 * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0}
064 */
065 public static final TelephoneType FAX = new TelephoneType("fax");
066
067 /**
068 * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0}
069 */
070 public static final TelephoneType HOME = new TelephoneType("home");
071
072 /**
073 * <b>Supported versions:</b> {@code 2.1, 3.0}
074 */
075 public static final TelephoneType ISDN = new TelephoneType("isdn", VCardVersion.V2_1, VCardVersion.V3_0);
076
077 /**
078 * <b>Supported versions:</b> {@code 2.1, 3.0}
079 */
080 public static final TelephoneType MODEM = new TelephoneType("modem", VCardVersion.V2_1, VCardVersion.V3_0);
081
082 /**
083 * <b>Supported versions:</b> {@code 2.1, 3.0}
084 */
085 public static final TelephoneType MSG = new TelephoneType("msg", VCardVersion.V2_1, VCardVersion.V3_0);
086
087 /**
088 * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0}
089 */
090 public static final TelephoneType PAGER = new TelephoneType("pager");
091
092 /**
093 * <b>Supported versions:</b> {@code 3.0}
094 */
095 public static final TelephoneType PCS = new TelephoneType("pcs", VCardVersion.V3_0);
096
097 /**
098 * <b>Supported versions:</b> {@code 2.1, 3.0}
099 */
100 public static final TelephoneType PREF = new TelephoneType("pref", VCardVersion.V2_1, VCardVersion.V3_0);
101
102 /**
103 * <b>Supported versions:</b> {@code 4.0}
104 */
105 public static final TelephoneType TEXT = new TelephoneType("text", VCardVersion.V4_0);
106
107 /**
108 * <b>Supported versions:</b> {@code 4.0}
109 */
110 public static final TelephoneType TEXTPHONE = new TelephoneType("textphone", VCardVersion.V4_0);
111
112 /**
113 * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0}
114 */
115 public static final TelephoneType VIDEO = new TelephoneType("video");
116
117 /**
118 * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0}
119 */
120 public static final TelephoneType VOICE = new TelephoneType("voice");
121
122 /**
123 * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0}
124 */
125 public static final TelephoneType WORK = new TelephoneType("work");
126
127 private TelephoneType(String value, VCardVersion... supportedVersions) {
128 super(value, supportedVersions);
129 }
130
131 /**
132 * Searches for a parameter value that is defined as a static constant in
133 * this class.
134 * @param value the parameter value
135 * @return the object or null if not found
136 */
137 public static TelephoneType find(String value) {
138 return enums.find(value);
139 }
140
141 /**
142 * Searches for a parameter value and creates one if it cannot be found. All
143 * objects are guaranteed to be unique, so they can be compared with
144 * {@code ==} equality.
145 * @param value the parameter value
146 * @return the object
147 */
148 public static TelephoneType get(String value) {
149 return enums.get(value);
150 }
151
152 /**
153 * Gets all of the parameter values that are defined as static constants in
154 * this class.
155 * @return the parameter values
156 */
157 public static Collection<TelephoneType> all() {
158 return enums.all();
159 }
160 }