Debian Codegraph @

src/main/java/ezvcard/property/Profile.java

raw symbols SCIP
1 package ezvcard.property;
2
3 import java.util.List;
4
5 import ezvcard.SupportedVersions;
6 import ezvcard.VCard;
7 import ezvcard.VCardVersion;
8 import ezvcard.ValidationWarning;
9
10 /*
11 Copyright (c) 2012-2023, Michael Angstadt
12 All rights reserved.
13
14 Redistribution and use in source and binary forms, with or without
15 modification, are permitted provided that the following conditions are met:
16
17 1. Redistributions of source code must retain the above copyright notice, this
18 list of conditions and the following disclaimer.
19 2. Redistributions in binary form must reproduce the above copyright notice,
20 this list of conditions and the following disclaimer in the documentation
21 and/or other materials provided with the distribution.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
27 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34 The views and conclusions contained in the software and documentation are those
35 of the authors and should not be interpreted as representing official policies,
36 either expressed or implied, of the FreeBSD Project.
37 */
38
39 /**
40 * <p>
41 * Simply identifies the vCard as a "vCard".
42 * </p>
43 *
44 * <p>
45 * <b>Code sample</b>
46 * </p>
47 *
48 * <pre class="brush:java">
49 * VCard vcard = new VCard();
50 *
51 * Profile profile = new Profile();
52 * vcard.setProfile(profile);
53 * </pre>
54 *
55 * <p>
56 * <b>Property name:</b> {@code PROFILE}
57 * </p>
58 * <p>
59 * <b>Supported versions:</b> {@code 3.0}
60 * </p>
61 * @author Michael Angstadt
62 * @see <a href="http://tools.ietf.org/html/rfc2426#page-5">RFC 2426 p.5</a>
63 */
64 @SupportedVersions(VCardVersion.V3_0)
65 public class Profile extends TextProperty {
66 public Profile() {
67 super("VCARD");
68 }
69
70 /**
71 * Copy constructor.
72 * @param original the property to make a copy of
73 */
74 public Profile(Profile original) {
75 super(original);
76 }
77
78 @Override
79 protected void _validate(List<ValidationWarning> warnings, VCardVersion version, VCard vcard) {
80 if (!"VCARD".equalsIgnoreCase(value)) {
81 //see RFC 2426 p.5
82 warnings.add(new ValidationWarning(18, value));
83 }
84 }
85
86 @Override
87 public Profile copy() {
88 return new Profile(this);
89 }
90 }