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 a list of keywords that can be used to describe the person. 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 * Categories categories = new Categories(); 051 * categories.getValues().add("Developer"); 052 * categories.getValues().add("Java coder"); 053 * categories.getValues().add("Ladies' man"); 054 * vcard.setCategories(categories); 055 * </pre> 056 * 057 * <p> 058 * <b>Property name:</b> {@code CATEGORIES} 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-43">RFC 6350 p.43</a> 065 * @see <a href="http://tools.ietf.org/html/rfc2426#page-20">RFC 2426 p.20</a> 066 */ 067@SupportedVersions({ VCardVersion.V3_0, VCardVersion.V4_0 }) 068public class Categories extends TextListProperty implements HasAltId { 069 public Categories() { 070 //empty 071 } 072 073 /** 074 * Copy constructor. 075 * @param original the property to make a copy of 076 */ 077 public Categories(Categories original) { 078 super(original); 079 } 080 081 @Override 082 public List<Pid> getPids() { 083 return super.getPids(); 084 } 085 086 @Override 087 public Integer getPref() { 088 return super.getPref(); 089 } 090 091 @Override 092 public void setPref(Integer pref) { 093 super.setPref(pref); 094 } 095 096 //@Override 097 public String getAltId() { 098 return parameters.getAltId(); 099 } 100 101 //@Override 102 public void setAltId(String altId) { 103 parameters.setAltId(altId); 104 } 105 106 /** 107 * Gets the TYPE parameter. 108 * <p> 109 * <b>Supported versions:</b> {@code 4.0} 110 * </p> 111 * @return the TYPE value (typically, this will be either "work" or "home") 112 * or null if it doesn't exist 113 */ 114 public String getType() { 115 return parameters.getType(); 116 } 117 118 /** 119 * Sets the TYPE parameter. 120 * <p> 121 * <b>Supported versions:</b> {@code 4.0} 122 * </p> 123 * @param type the TYPE value (this should be either "work" or "home") or 124 * null to remove 125 */ 126 public void setType(String type) { 127 parameters.setType(type); 128 } 129 130 @Override 131 public Categories copy() { 132 return new Categories(this); 133 } 134}