| 1 | package ezvcard.property; |
| 2 | |
| 3 | import java.util.List; |
| 4 | |
| 5 | import ezvcard.parameter.Pid; |
| 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 | * <p> |
| 38 | * Defines a free-form text field that contains miscellaneous information. |
| 39 | * </p> |
| 40 | * |
| 41 | * <p> |
| 42 | * <b>Code sample</b> |
| 43 | * </p> |
| 44 | * |
| 45 | * <pre class="brush:java"> |
| 46 | * VCard vcard = new VCard(); |
| 47 | * |
| 48 | * Note note = new Note("This is a\nnote property."); |
| 49 | * vcard.addNote(note); |
| 50 | * </pre> |
| 51 | * |
| 52 | * <p> |
| 53 | * <b>Property name:</b> {@code NOTE} |
| 54 | * </p> |
| 55 | * <p> |
| 56 | * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0} |
| 57 | * </p> |
| 58 | * @author Michael Angstadt |
| 59 | * @see <a href="http://tools.ietf.org/html/rfc6350#page-44">RFC 6350 p.44</a> |
| 60 | * @see <a href="http://tools.ietf.org/html/rfc2426#page-21">RFC 2426 p.21</a> |
| 61 | * @see <a href="http://www.imc.org/pdi/vcard-21.doc">vCard 2.1 p.19</a> |
| 62 | */ |
| 63 | public class Note extends TextProperty implements HasAltId { |
| 64 | /** |
| 65 | * Creates a note property. |
| 66 | * @param note the note text |
| 67 | */ |
| 68 | public Note(String note) { |
| 69 | super(note); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Copy constructor. |
| 74 | * @param original the property to make a copy of |
| 75 | */ |
| 76 | public Note(Note original) { |
| 77 | super(original); |
| 78 | } |
| 79 | |
| 80 | @Override |
| 81 | public List<Pid> getPids() { |
| 82 | return super.getPids(); |
| 83 | } |
| 84 | |
| 85 | @Override |
| 86 | public Integer getPref() { |
| 87 | return super.getPref(); |
| 88 | } |
| 89 | |
| 90 | @Override |
| 91 | public void setPref(Integer pref) { |
| 92 | super.setPref(pref); |
| 93 | } |
| 94 | |
| 95 | //@Override |
| 96 | public String getAltId() { |
| 97 | return parameters.getAltId(); |
| 98 | } |
| 99 | |
| 100 | //@Override |
| 101 | public void setAltId(String altId) { |
| 102 | parameters.setAltId(altId); |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Gets the TYPE parameter. |
| 107 | * <p> |
| 108 | * <b>Supported versions:</b> {@code 4.0} |
| 109 | * </p> |
| 110 | * @return the TYPE value (typically, this will be either "work" or "home") |
| 111 | * or null if it doesn't exist |
| 112 | */ |
| 113 | public String getType() { |
| 114 | return parameters.getType(); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Sets the TYPE parameter. |
| 119 | * <p> |
| 120 | * <b>Supported versions:</b> {@code 4.0} |
| 121 | * </p> |
| 122 | * @param type the TYPE value (this should be either "work" or "home") or |
| 123 | * null to remove |
| 124 | */ |
| 125 | public void setType(String type) { |
| 126 | parameters.setType(type); |
| 127 | } |
| 128 | |
| 129 | @Override |
| 130 | public String getLanguage() { |
| 131 | return super.getLanguage(); |
| 132 | } |
| 133 | |
| 134 | @Override |
| 135 | public void setLanguage(String language) { |
| 136 | super.setLanguage(language); |
| 137 | } |
| 138 | |
| 139 | @Override |
| 140 | public Note copy() { |
| 141 | return new Note(this); |
| 142 | } |
| 143 | } |