001 package ezvcard.property;
002
003 import ezvcard.VCardDataType;
004
005 /*
006 Copyright (c) 2013, Michael Angstadt
007 All rights reserved.
008
009 Redistribution and use in source and binary forms, with or without
010 modification, are permitted provided that the following conditions are met:
011
012 1. Redistributions of source code must retain the above copyright notice, this
013 list of conditions and the following disclaimer.
014 2. Redistributions in binary form must reproduce the above copyright notice,
015 this list of conditions and the following disclaimer in the documentation
016 and/or other materials provided with the distribution.
017
018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
019 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
020 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
021 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
022 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
023 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
024 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
025 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
026 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
027 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028
029 The views and conclusions contained in the software and documentation are those
030 of the authors and should not be interpreted as representing official policies,
031 either expressed or implied, of the FreeBSD Project.
032 */
033
034 /**
035 * Holds the property value as-is. No escaping or unescaping is done on the
036 * value.
037 * @author Michael Angstadt
038 */
039 public class RawProperty extends TextProperty {
040 private String propertyName;
041 private VCardDataType dataType;
042
043 /**
044 * Creates a raw property.
045 * @param propertyName the property name (e.g. "X-GENDER")
046 * @param value the property value
047 */
048 public RawProperty(String propertyName, String value) {
049 this(propertyName, value, null);
050 }
051
052 /**
053 * Creates a raw property.
054 * @param propertyName the property name (e.g. "X-GENDER")
055 * @param value the property value
056 * @param dataType the value's data type
057 */
058 public RawProperty(String propertyName, String value, VCardDataType dataType) {
059 super(value);
060 this.propertyName = propertyName;
061 this.dataType = dataType;
062 }
063
064 /**
065 * Gets the name of the property.
066 * @return the property name
067 */
068 public String getPropertyName() {
069 return propertyName;
070 }
071
072 /**
073 * Sets the name of the property.
074 * @param propertyName the property name
075 */
076 public void setPropertyName(String propertyName) {
077 this.propertyName = propertyName;
078 }
079
080 /**
081 * Gets the data type of the property's value.
082 * @return the data type or null if unknown
083 */
084 public VCardDataType getDataType() {
085 return dataType;
086 }
087
088 /**
089 * Sets the data type of the property's value.
090 * @param dataType the data type or null if unknown
091 */
092 public void setDataType(VCardDataType dataType) {
093 this.dataType = dataType;
094 }
095 }