Debian Codegraph @

src/main/java/ezvcard/property/Interest.java

raw symbols SCIP
1 package ezvcard.property;
2
3 import ezvcard.SupportedVersions;
4 import ezvcard.VCardVersion;
5 import ezvcard.parameter.InterestLevel;
6 import ezvcard.parameter.VCardParameters;
7
8 /*
9 Copyright (c) 2012-2023, Michael Angstadt
10 All rights reserved.
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14
15 1. Redistributions of source code must retain the above copyright notice, this
16 list of conditions and the following disclaimer.
17 2. Redistributions in binary form must reproduce the above copyright notice,
18 this list of conditions and the following disclaimer in the documentation
19 and/or other materials provided with the distribution.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
25 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 The views and conclusions contained in the software and documentation are those
33 of the authors and should not be interpreted as representing official policies,
34 either expressed or implied, of the FreeBSD Project.
35 */
36
37 /**
38 * <p>
39 * Defines a recreational activity that the person is interested in. For
40 * example, if a person has an interest in "hockey", it would mean that he likes
41 * to watch hockey games. Someone who likes to actually <i>play</i> hockey would
42 * list hockey as a {@link Hobby} instead.
43 * </p>
44 *
45 * <p>
46 * <b>Code sample</b>
47 * </p>
48 *
49 * <pre class="brush:java">
50 * VCard vcard = new VCard();
51 *
52 * Interest interest = new Interest("hockey");
53 * interest.setLevel(InterestLevel.HIGH);
54 * vcard.addInterest(interest);
55 * </pre>
56 *
57 * <p>
58 * <b>Property name:</b> {@code INTEREST}
59 * </p>
60 * <p>
61 * <b>Supported versions:</b> {@code 4.0}
62 * </p>
63 * @author Michael Angstadt
64 * @see <a href="http://tools.ietf.org/html/rfc6715#page-5">RFC 6715 p.5</a>
65 */
66 @SupportedVersions(VCardVersion.V4_0)
67 public class Interest extends TextProperty implements HasAltId {
68 /**
69 * Creates an interest property.
70 * @param interest the hobby (e.g. "wind surfing")
71 */
72 public Interest(String interest) {
73 super(interest);
74 }
75
76 /**
77 * Copy constructor.
78 * @param original the property to make a copy of
79 */
80 public Interest(Interest original) {
81 super(original);
82 }
83
84 /**
85 * Gets the level of the person's interest.
86 * @return the interest level (e.g. "low") or null if not set
87 * @see VCardParameters#getLevel
88 */
89 public InterestLevel getLevel() {
90 String value = parameters.getLevel();
91 return (value == null) ? null : InterestLevel.get(value);
92 }
93
94 /**
95 * Sets the level of the person's interest.
96 * @param level the level (e.g. "low") or null to remove
97 * @see VCardParameters#setLevel
98 */
99 public void setLevel(InterestLevel level) {
100 String value = (level == null) ? null : level.getValue();
101 parameters.setLevel(value);
102 }
103
104 @Override
105 public Integer getIndex() {
106 return super.getIndex();
107 }
108
109 @Override
110 public void setIndex(Integer index) {
111 super.setIndex(index);
112 }
113
114 /**
115 * Gets the TYPE parameter.
116 * @return the TYPE value (typically, this will be either "work" or "home")
117 * or null if it doesn't exist
118 */
119 public String getType() {
120 return parameters.getType();
121 }
122
123 /**
124 * Sets the TYPE parameter.
125 * @param type the TYPE value (this should be either "work" or "home") or
126 * null to remove
127 */
128 public void setType(String type) {
129 parameters.setType(type);
130 }
131
132 @Override
133 public String getLanguage() {
134 return super.getLanguage();
135 }
136
137 @Override
138 public void setLanguage(String language) {
139 super.setLanguage(language);
140 }
141
142 @Override
143 public Integer getPref() {
144 return super.getPref();
145 }
146
147 @Override
148 public void setPref(Integer pref) {
149 super.setPref(pref);
150 }
151
152 //@Override
153 public String getAltId() {
154 return parameters.getAltId();
155 }
156
157 //@Override
158 public void setAltId(String altId) {
159 parameters.setAltId(altId);
160 }
161
162 @Override
163 public Interest copy() {
164 return new Interest(this);
165 }
166 }