001package ezvcard.parameter;
002
003import java.util.Collection;
004
005import ezvcard.property.Related;
006
007/*
008 Copyright (c) 2012-2023, Michael Angstadt
009 All rights reserved.
010
011 Redistribution and use in source and binary forms, with or without
012 modification, are permitted provided that the following conditions are met: 
013
014 1. Redistributions of source code must retain the above copyright notice, this
015 list of conditions and the following disclaimer. 
016 2. Redistributions in binary form must reproduce the above copyright notice,
017 this list of conditions and the following disclaimer in the documentation
018 and/or other materials provided with the distribution. 
019
020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
021 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
022 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
023 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
024 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
025 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
026 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
027 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
028 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
029 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030
031 The views and conclusions contained in the software and documentation are those
032 of the authors and should not be interpreted as representing official policies, 
033 either expressed or implied, of the FreeBSD Project.
034 */
035
036/**
037 * Represents the TYPE parameter of the {@link Related} property.
038 * <p>
039 * <b>Supported versions:</b> {@code 4.0}
040 * </p>
041 * @author Michael Angstadt
042 */
043public class RelatedType extends VCardParameter {
044        private static final VCardParameterCaseClasses<RelatedType> enums = new VCardParameterCaseClasses<>(RelatedType.class);
045
046        public static final RelatedType ACQUAINTANCE = new RelatedType("acquaintance");
047        public static final RelatedType AGENT = new RelatedType("agent");
048        public static final RelatedType CHILD = new RelatedType("child");
049        public static final RelatedType CO_RESIDENT = new RelatedType("co-resident");
050        public static final RelatedType CO_WORKER = new RelatedType("co-worker");
051        public static final RelatedType COLLEAGUE = new RelatedType("colleague");
052        public static final RelatedType CONTACT = new RelatedType("contact");
053        public static final RelatedType CRUSH = new RelatedType("crush");
054        public static final RelatedType DATE = new RelatedType("date");
055        public static final RelatedType EMERGENCY = new RelatedType("emergency");
056        public static final RelatedType FRIEND = new RelatedType("friend");
057        public static final RelatedType KIN = new RelatedType("kin");
058        public static final RelatedType ME = new RelatedType("me");
059        public static final RelatedType MET = new RelatedType("met");
060        public static final RelatedType MUSE = new RelatedType("muse");
061        public static final RelatedType NEIGHBOR = new RelatedType("neighbor");
062        public static final RelatedType PARENT = new RelatedType("parent");
063        public static final RelatedType SIBLING = new RelatedType("sibling");
064        public static final RelatedType SPOUSE = new RelatedType("spouse");
065        public static final RelatedType SWEETHEART = new RelatedType("sweetheart");
066
067        private RelatedType(String value) {
068                super(value);
069        }
070
071        /**
072         * Searches for a parameter value that is defined as a static constant in
073         * this class.
074         * @param value the parameter value
075         * @return the object or null if not found
076         */
077        public static RelatedType find(String value) {
078                return enums.find(value);
079        }
080
081        /**
082         * Searches for a parameter value and creates one if it cannot be found. All
083         * objects are guaranteed to be unique, so they can be compared with
084         * {@code ==} equality.
085         * @param value the parameter value
086         * @return the object
087         */
088        public static RelatedType get(String value) {
089                return enums.get(value);
090        }
091
092        /**
093         * Gets all of the parameter values that are defined as static constants in
094         * this class.
095         * @return the parameter values
096         */
097        public static Collection<RelatedType> all() {
098                return enums.all();
099        }
100}