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.Telephone; 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 Telephone} property. 043 * <p> 044 * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0} 045 * </p> 046 * @author Michael Angstadt 047 */ 048public class TelephoneType extends VCardParameter { 049 private static final VCardParameterCaseClasses<TelephoneType> enums = new VCardParameterCaseClasses<>(TelephoneType.class); 050 051 @SupportedVersions({ V2_1, V3_0 }) 052 public static final TelephoneType BBS = new TelephoneType("bbs"); 053 054 @SupportedVersions({ V2_1, V3_0 }) 055 public static final TelephoneType CAR = new TelephoneType("car"); 056 057 public static final TelephoneType CELL = new TelephoneType("cell"); 058 059 public static final TelephoneType FAX = new TelephoneType("fax"); 060 061 public static final TelephoneType HOME = new TelephoneType("home"); 062 063 @SupportedVersions({ V2_1, V3_0 }) 064 public static final TelephoneType ISDN = new TelephoneType("isdn"); 065 066 @SupportedVersions({ V2_1, V3_0 }) 067 public static final TelephoneType MODEM = new TelephoneType("modem"); 068 069 @SupportedVersions({ V2_1, V3_0 }) 070 public static final TelephoneType MSG = new TelephoneType("msg"); 071 072 public static final TelephoneType PAGER = new TelephoneType("pager"); 073 074 @SupportedVersions(V3_0) 075 public static final TelephoneType PCS = new TelephoneType("pcs"); 076 077 @SupportedVersions({ V2_1, V3_0 }) 078 public static final TelephoneType PREF = new TelephoneType("pref"); 079 080 @SupportedVersions(V4_0) 081 public static final TelephoneType TEXT = new TelephoneType("text"); 082 083 @SupportedVersions(V4_0) 084 public static final TelephoneType TEXTPHONE = new TelephoneType("textphone"); 085 086 public static final TelephoneType VIDEO = new TelephoneType("video"); 087 088 public static final TelephoneType VOICE = new TelephoneType("voice"); 089 090 public static final TelephoneType WORK = new TelephoneType("work"); 091 092 private TelephoneType(String value) { 093 super(value); 094 } 095 096 /** 097 * Searches for a parameter value that is defined as a static constant in 098 * this class. 099 * @param value the parameter value 100 * @return the object or null if not found 101 */ 102 public static TelephoneType find(String value) { 103 return enums.find(value); 104 } 105 106 /** 107 * Searches for a parameter value and creates one if it cannot be found. All 108 * objects are guaranteed to be unique, so they can be compared with 109 * {@code ==} equality. 110 * @param value the parameter value 111 * @return the object 112 */ 113 public static TelephoneType get(String value) { 114 return enums.get(value); 115 } 116 117 /** 118 * Gets all of the parameter values that are defined as static constants in 119 * this class. 120 * @return the parameter values 121 */ 122 public static Collection<TelephoneType> all() { 123 return enums.all(); 124 } 125}