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