001 package ezvcard.parameters;
002
003 /*
004 Copyright (c) 2012, Michael Angstadt
005 All rights reserved.
006
007 Redistribution and use in source and binary forms, with or without
008 modification, are permitted provided that the following conditions are met:
009
010 1. Redistributions of source code must retain the above copyright notice, this
011 list of conditions and the following disclaimer.
012 2. Redistributions in binary form must reproduce the above copyright notice,
013 this list of conditions and the following disclaimer in the documentation
014 and/or other materials provided with the distribution.
015
016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
020 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
023 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
026
027 The views and conclusions contained in the software and documentation are those
028 of the authors and should not be interpreted as representing official policies,
029 either expressed or implied, of the FreeBSD Project.
030 */
031
032 /**
033 * Represents a VALUE parameter.
034 * @author Michael Angstadt
035 */
036 public class ValueParameter extends VCardParameter {
037 public static final String NAME = "VALUE";
038
039 /**
040 * vCard versions: 2.1 (p.18-9)
041 */
042 public static final ValueParameter URL = new ValueParameter("url");
043
044 /**
045 * vCard versions: 2.1 (p.8-9)
046 */
047 public static final ValueParameter CONTENT_ID = new ValueParameter("content-id");
048
049 /**
050 * vCard versions: 3.0
051 */
052 public static final ValueParameter BINARY = new ValueParameter("binary");
053
054 /**
055 * vCard versions: 3.0, 4.0
056 */
057 public static final ValueParameter URI = new ValueParameter("uri");
058
059 /**
060 * vCard versions: 3.0, 4.0
061 */
062 public static final ValueParameter TEXT = new ValueParameter("text");
063
064 /**
065 * vCard versions: 3.0, 4.0
066 */
067 public static final ValueParameter DATE = new ValueParameter("date");
068
069 /**
070 * vCard versions: 3.0, 4.0
071 */
072 public static final ValueParameter TIME = new ValueParameter("time");
073
074 /**
075 * vCard versions: 3.0, 4.0
076 */
077 public static final ValueParameter DATE_TIME = new ValueParameter("date-time");
078
079 /**
080 * vCard versions: 4.0
081 */
082 public static final ValueParameter DATE_AND_OR_TIME = new ValueParameter("date-and-or-time");
083
084 /**
085 * vCard versions: 4.0
086 */
087 public static final ValueParameter TIMESTAMP = new ValueParameter("timestamp");
088
089 /**
090 * vCard versions: 4.0
091 */
092 public static final ValueParameter BOOLEAN = new ValueParameter("boolean");
093
094 /**
095 * vCard versions: 4.0
096 */
097 public static final ValueParameter INTEGER = new ValueParameter("integer");
098
099 /**
100 * vCard versions: 4.0
101 */
102 public static final ValueParameter FLOAT = new ValueParameter("float");
103
104 /**
105 * vCard versions: 4.0
106 */
107 public static final ValueParameter UTC_OFFSET = new ValueParameter("utc-offset");
108
109 /**
110 * vCard versions: 4.0
111 */
112 public static final ValueParameter LANGUAGE_TAG = new ValueParameter("language-tag");
113
114 /**
115 * Use of this constructor is discouraged and should only be used for
116 * defining non-standard VALUEs. Please use one of the predefined static
117 * objects.
118 * @param value the type value (e.g. "uri")
119 */
120 public ValueParameter(String value) {
121 super(NAME, value);
122 }
123
124 /**
125 * Searches the static objects in this class for one that has a certain type
126 * value.
127 * @param value the type value to search for (e.g. "text")
128 * @return the object or null if not found
129 */
130 public static ValueParameter valueOf(String value) {
131 return findByValue(value, ValueParameter.class);
132 }
133 }