001 package ezvcard.parameter; 002 003 import java.util.Collection; 004 005 import ezvcard.VCardVersion; 006 import ezvcard.property.Email; 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 Email} properties. 039 * <p> 040 * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0} 041 * </p> 042 * @author Michael Angstadt 043 */ 044 public class EmailType extends VersionedVCardParameter { 045 private static final VCardParameterCaseClasses<EmailType> enums = new VCardParameterCaseClasses<EmailType>(EmailType.class); 046 047 /** 048 * <b>Supported versions:</b> {@code 2.1, 3.0} 049 */ 050 public static final EmailType INTERNET = new EmailType("internet", VCardVersion.V2_1, VCardVersion.V3_0); 051 052 /** 053 * <b>Supported versions:</b> {@code 2.1, 3.0} 054 */ 055 public static final EmailType X400 = new EmailType("x400", VCardVersion.V2_1, VCardVersion.V3_0); 056 057 /** 058 * <b>Supported versions:</b> {@code 2.1, 3.0} 059 */ 060 public static final EmailType PREF = new EmailType("pref", VCardVersion.V2_1, VCardVersion.V3_0); 061 062 /** 063 * <b>Supported versions:</b> {@code 2.1 (suggested)} 064 */ 065 public static final EmailType AOL = new EmailType("aol", VCardVersion.V2_1); 066 067 /** 068 * <b>Supported versions:</b> {@code 2.1 (suggested)} 069 */ 070 public static final EmailType APPLELINK = new EmailType("applelink", VCardVersion.V2_1); 071 072 /** 073 * <b>Supported versions:</b> {@code 2.1 (suggested)} 074 */ 075 public static final EmailType ATTMAIL = new EmailType("attmail", VCardVersion.V2_1); 076 077 /** 078 * <b>Supported versions:</b> {@code 2.1 (suggested)} 079 */ 080 public static final EmailType CIS = new EmailType("cis", VCardVersion.V2_1); 081 082 /** 083 * <b>Supported versions:</b> {@code 2.1 (suggested)} 084 */ 085 public static final EmailType EWORLD = new EmailType("eworld", VCardVersion.V2_1); 086 087 /** 088 * <b>Supported versions:</b> {@code 2.1 (suggested)} 089 */ 090 public static final EmailType IBMMAIL = new EmailType("ibmmail", VCardVersion.V2_1); 091 092 /** 093 * <b>Supported versions:</b> {@code 2.1 (suggested)} 094 */ 095 public static final EmailType MCIMAIL = new EmailType("mcimail", VCardVersion.V2_1); 096 097 /** 098 * <b>Supported versions:</b> {@code 2.1 (suggested)} 099 */ 100 public static final EmailType POWERSHARE = new EmailType("powershare", VCardVersion.V2_1); 101 102 /** 103 * <b>Supported versions:</b> {@code 2.1 (suggested)} 104 */ 105 public static final EmailType PRODIGY = new EmailType("prodigy", VCardVersion.V2_1); 106 107 /** 108 * <b>Supported versions:</b> {@code 2.1 (suggested)} 109 */ 110 public static final EmailType TLX = new EmailType("tlx", VCardVersion.V2_1); 111 112 /** 113 * <b>Supported versions:</b> {@code 4.0} 114 */ 115 public static final EmailType HOME = new EmailType("home", VCardVersion.V4_0); 116 117 /** 118 * <b>Supported versions:</b> {@code 4.0} 119 */ 120 public static final EmailType WORK = new EmailType("work", VCardVersion.V4_0); 121 122 private EmailType(String value, VCardVersion... supportedVersions) { 123 super(value, supportedVersions); 124 } 125 126 /** 127 * Searches for a parameter value that is defined as a static constant in 128 * this class. 129 * @param value the parameter value 130 * @return the object or null if not found 131 */ 132 public static EmailType find(String value) { 133 return enums.find(value); 134 } 135 136 /** 137 * Searches for a parameter value and creates one if it cannot be found. All 138 * objects are guaranteed to be unique, so they can be compared with 139 * {@code ==} equality. 140 * @param value the parameter value 141 * @return the object 142 */ 143 public static EmailType get(String value) { 144 return enums.get(value); 145 } 146 147 /** 148 * Gets all of the parameter values that are defined as static constants in 149 * this class. 150 * @return the parameter values 151 */ 152 public static Collection<EmailType> all() { 153 return enums.all(); 154 } 155 }