001package ezvcard.property;
002
003import ezvcard.SupportedVersions;
004import ezvcard.VCardVersion;
005
006/*
007 Copyright (c) 2012-2023, Michael Angstadt
008 All rights reserved.
009
010 Redistribution and use in source and binary forms, with or without
011 modification, are permitted provided that the following conditions are met: 
012
013 1. Redistributions of source code must retain the above copyright notice, this
014 list of conditions and the following disclaimer. 
015 2. Redistributions in binary form must reproduce the above copyright notice,
016 this list of conditions and the following disclaimer in the documentation
017 and/or other materials provided with the distribution. 
018
019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
022 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
023 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
024 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
025 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
026 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
027 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
028 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029
030 The views and conclusions contained in the software and documentation are those
031 of the authors and should not be interpreted as representing official policies, 
032 either expressed or implied, of the FreeBSD Project.
033 */
034
035/**
036 * <p>
037 * Defines the string that should be used when an application sorts this vCard
038 * in some way.
039 * </p>
040 * 
041 * <p>
042 * This property is not supported in 4.0. Instead, use the
043 * {@link StructuredName#setSortAs(String)} and/or {@link Organization#setSortAs}
044 * methods when creating version 4.0 vCards.
045 * </p>
046 * 
047 * <p>
048 * <b>Code sample (3.0)</b>
049 * </p>
050 * 
051 * <pre class="brush:java">
052 * VCard vcard = new VCard();
053 * 
054 * StructuredName n = new StructuredName();
055 * n.setFamily("d'Armour");
056 * n.setGiven("Miles");
057 * vcard.setStructuredName(n);
058 * SortString sortString = new SortString("Armour");
059 * vcard.setSortString(sortString);
060 * </pre>
061 * 
062 * <p>
063 * <b>Code sample (4.0)</b>
064 * </p>
065 * 
066 * <pre class="brush:java">
067 * VCard vcard = new VCard();
068 * 
069 * StructuredName n = new StructuredName();
070 * n.setFamily("d'Armour");
071 * n.setGiven("Miles");
072 * n.setSortAs("Armour");
073 * vcard.setStructuredName(n);
074 * </pre>
075 * 
076 * <p>
077 * <b>Property name:</b> {@code SORT-STRING}
078 * </p>
079 * <p>
080 * <b>Supported versions:</b> {@code 3.0}
081 * </p>
082 * @author Michael Angstadt
083 * @see <a href="http://tools.ietf.org/html/rfc2426#page-22">RFC 2426 p.22</a>
084 */
085@SupportedVersions(VCardVersion.V3_0)
086public class SortString extends TextProperty {
087        /**
088         * Creates a sort-string property.
089         * @param sortString the sort string
090         */
091        public SortString(String sortString) {
092                super(sortString);
093        }
094
095        /**
096         * Copy constructor.
097         * @param original the property to make a copy of
098         */
099        public SortString(SortString original) {
100                super(original);
101        }
102
103        @Override
104        public SortString copy() {
105                return new SortString(this);
106        }
107}