001    package ezvcard.property;
002    
003    import java.util.EnumSet;
004    import java.util.List;
005    import java.util.Set;
006    
007    import ezvcard.VCardVersion;
008    
009    /*
010     Copyright (c) 2013, 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     * A list of nicknames the person goes by.
040     * 
041     * <p>
042     * <b>Code sample</b>
043     * </p>
044     * 
045     * <pre class="brush:java">
046     * VCard vcard = new VCard();
047     * Nickname nickname = new Nickname();
048     * nickname.addValue(&quot;Rick&quot;);
049     * nickname.addValue(&quot;Ricky&quot;);
050     * nickname.addValue(&quot;Bobby&quot;);
051     * vcard.setNickname(nickname);
052     * </pre>
053     * 
054     * <p>
055     * <b>Property name:</b> {@code NICKNAME}
056     * </p>
057     * <p>
058     * <b>Supported versions:</b> {@code 3.0, 4.0}
059     * </p>
060     * @author Michael Angstadt
061     */
062    public class Nickname extends TextListProperty implements HasAltId {
063            @Override
064            public Set<VCardVersion> _supportedVersions() {
065                    return EnumSet.of(VCardVersion.V3_0, VCardVersion.V4_0);
066            }
067    
068            /**
069             * Gets the TYPE parameter.
070             * <p>
071             * <b>Supported versions:</b> {@code 4.0}
072             * </p>
073             * @return the TYPE value (typically, this will be either "work" or "home")
074             * or null if it doesn't exist
075             */
076            public String getType() {
077                    return parameters.getType();
078            }
079    
080            /**
081             * Sets the TYPE parameter.
082             * <p>
083             * <b>Supported versions:</b> {@code 4.0}
084             * </p>
085             * @param type the TYPE value (this should be either "work" or "home") or
086             * null to remove
087             */
088            public void setType(String type) {
089                    parameters.setType(type);
090            }
091    
092            @Override
093            public String getLanguage() {
094                    return super.getLanguage();
095            }
096    
097            @Override
098            public void setLanguage(String language) {
099                    super.setLanguage(language);
100            }
101    
102            @Override
103            public List<Integer[]> getPids() {
104                    return super.getPids();
105            }
106    
107            @Override
108            public void addPid(int localId, int clientPidMapRef) {
109                    super.addPid(localId, clientPidMapRef);
110            }
111    
112            @Override
113            public void removePids() {
114                    super.removePids();
115            }
116    
117            @Override
118            public Integer getPref() {
119                    return super.getPref();
120            }
121    
122            @Override
123            public void setPref(Integer pref) {
124                    super.setPref(pref);
125            }
126    
127            //@Override
128            public String getAltId() {
129                    return parameters.getAltId();
130            }
131    
132            //@Override
133            public void setAltId(String altId) {
134                    parameters.setAltId(altId);
135            }
136    }