001package ezvcard.property; 002 003import java.util.List; 004 005import ezvcard.SupportedVersions; 006import ezvcard.VCardVersion; 007import ezvcard.parameter.Pid; 008 009/* 010 Copyright (c) 2012-2023, Michael Angstadt 011 All rights reserved. 012 013 Redistribution and use in source and binary forms, with or without 014 modification, are permitted provided that the following conditions are met: 015 016 1. Redistributions of source code must retain the above copyright notice, this 017 list of conditions and the following disclaimer. 018 2. Redistributions in binary form must reproduce the above copyright notice, 019 this list of conditions and the following disclaimer in the documentation 020 and/or other materials provided with the distribution. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 025 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 026 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 027 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 028 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 029 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 030 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 031 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 032 033 The views and conclusions contained in the software and documentation are those 034 of the authors and should not be interpreted as representing official policies, 035 either expressed or implied, of the FreeBSD Project. 036 */ 037 038/** 039 * <p> 040 * Defines the person's nicknames. 041 * </p> 042 * 043 * <p> 044 * <b>Code sample</b> 045 * </p> 046 * 047 * <pre class="brush:java"> 048 * VCard vcard = new VCard(); 049 * 050 * Nickname nickname = new Nickname(); 051 * nickname.getValues().add("Ricky"); 052 * nickname.getValues().add("Bobby"); 053 * nickname.getValues().add("Ricky Bobby"); 054 * vcard.setNickname(nickname); 055 * </pre> 056 * 057 * <p> 058 * <b>Property name:</b> {@code NICKNAME} 059 * </p> 060 * <p> 061 * <b>Supported versions:</b> {@code 3.0, 4.0} 062 * </p> 063 * @author Michael Angstadt 064 * @see <a href="http://tools.ietf.org/html/rfc6350#page-29">RFC 6350 p.29</a> 065 * @see <a href="http://tools.ietf.org/html/rfc2426#page-9">RFC 2426 p.9</a> 066 */ 067@SupportedVersions({ VCardVersion.V3_0, VCardVersion.V4_0 }) 068public class Nickname extends TextListProperty implements HasAltId { 069 public Nickname() { 070 //empty 071 } 072 073 /** 074 * Copy constructor. 075 * @param original the property to make a copy of 076 */ 077 public Nickname(Nickname original) { 078 super(original); 079 } 080 081 /** 082 * Gets the TYPE parameter. 083 * <p> 084 * <b>Supported versions:</b> {@code 4.0} 085 * </p> 086 * @return the TYPE value (typically, this will be either "work" or "home") 087 * or null if it doesn't exist 088 */ 089 public String getType() { 090 return parameters.getType(); 091 } 092 093 /** 094 * Sets the TYPE parameter. 095 * <p> 096 * <b>Supported versions:</b> {@code 4.0} 097 * </p> 098 * @param type the TYPE value (this should be either "work" or "home") or 099 * null to remove 100 */ 101 public void setType(String type) { 102 parameters.setType(type); 103 } 104 105 @Override 106 public String getLanguage() { 107 return super.getLanguage(); 108 } 109 110 @Override 111 public void setLanguage(String language) { 112 super.setLanguage(language); 113 } 114 115 @Override 116 public List<Pid> getPids() { 117 return super.getPids(); 118 } 119 120 @Override 121 public Integer getPref() { 122 return super.getPref(); 123 } 124 125 @Override 126 public void setPref(Integer pref) { 127 super.setPref(pref); 128 } 129 130 //@Override 131 public String getAltId() { 132 return parameters.getAltId(); 133 } 134 135 //@Override 136 public void setAltId(String altId) { 137 parameters.setAltId(altId); 138 } 139 140 @Override 141 public Nickname copy() { 142 return new Nickname(this); 143 } 144}