| 1 | package ezvcard.parameter; |
| 2 | |
| 3 | import java.util.Collection; |
| 4 | |
| 5 | import ezvcard.property.Impp; |
| 6 | |
| 7 | /* |
| 8 | Copyright (c) 2012-2023, Michael Angstadt |
| 9 | All rights reserved. |
| 10 | |
| 11 | Redistribution and use in source and binary forms, with or without |
| 12 | modification, are permitted provided that the following conditions are met: |
| 13 | |
| 14 | 1. Redistributions of source code must retain the above copyright notice, this |
| 15 | list of conditions and the following disclaimer. |
| 16 | 2. Redistributions in binary form must reproduce the above copyright notice, |
| 17 | this list of conditions and the following disclaimer in the documentation |
| 18 | and/or other materials provided with the distribution. |
| 19 | |
| 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | |
| 31 | The views and conclusions contained in the software and documentation are those |
| 32 | of the authors and should not be interpreted as representing official policies, |
| 33 | either expressed or implied, of the FreeBSD Project. |
| 34 | */ |
| 35 | |
| 36 | /** |
| 37 | * Represents the TYPE parameter of the {@link Impp} property. |
| 38 | * <p> |
| 39 | * <b>Supported versions:</b> {@code 4.0} |
| 40 | * </p> |
| 41 | * @author Michael Angstadt |
| 42 | */ |
| 43 | public class ImppType extends VCardParameter { |
| 44 | private static final VCardParameterCaseClasses<ImppType> enums = new VCardParameterCaseClasses<>(ImppType.class); |
| 45 | |
| 46 | public static final ImppType PERSONAL = new ImppType("personal"); |
| 47 | public static final ImppType BUSINESS = new ImppType("business"); |
| 48 | public static final ImppType HOME = new ImppType("home"); |
| 49 | public static final ImppType WORK = new ImppType("work"); |
| 50 | public static final ImppType MOBILE = new ImppType("mobile"); |
| 51 | public static final ImppType PREF = new ImppType("pref"); |
| 52 | |
| 53 | private ImppType(String value) { |
| 54 | super(value); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Searches for a parameter value that is defined as a static constant in |
| 59 | * this class. |
| 60 | * @param value the parameter value |
| 61 | * @return the object or null if not found |
| 62 | */ |
| 63 | public static ImppType find(String value) { |
| 64 | return enums.find(value); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Searches for a parameter value and creates one if it cannot be found. All |
| 69 | * objects are guaranteed to be unique, so they can be compared with |
| 70 | * {@code ==} equality. |
| 71 | * @param value the parameter value |
| 72 | * @return the object |
| 73 | */ |
| 74 | public static ImppType get(String value) { |
| 75 | return enums.get(value); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Gets all of the parameter values that are defined as static constants in |
| 80 | * this class. |
| 81 | * @return the parameter values |
| 82 | */ |
| 83 | public static Collection<ImppType> all() { |
| 84 | return enums.all(); |
| 85 | } |
| 86 | } |