gt:         if (propertyValue instanceof String) {
context: /*
   * Funambol is a mobile platform developed by Funambol, Inc.
   * Copyright (C) 2003 - 2007 Funambol, Inc.
   *
   * This program is free software; you can redistribute it and/or modify it under
   * the terms of the GNU Affero General Public License version 3 as published by
   * the Free Software Foundation with the addition of the following permission
   * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
   * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE
   * WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
   *
   * This program is distributed in the hope that it will be useful, but WITHOUT
   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   * details.
   *
   * You should have received a copy of the GNU Affero General Public License
   * along with this program; if not, see http://www.gnu.org/licenses or write to
   * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
   * MA 02110-1301 USA.
   *
   * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite
   * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
   *
   * The interactive user interfaces in modified source and object code versions
   * of this program must display Appropriate Legal Notices, as required under
   * Section 5 of the GNU Affero General Public License version 3.
   *
   * In accordance with Section 7(b) of the GNU Affero General Public License
   * version 3, these Appropriate Legal Notices must retain the display of the
   * "Powered by Funambol" logo. If the display of the logo is not reasonably
   * feasible for technical reasons, the Appropriate Legal Notices must display
   * the words "Powered by Funambol".
   */
  package com.funambol.common.pim.common;
  
  import java.util.HashMap;
  
  import java.util.Map;
  import org.apache.commons.lang.StringUtils;
  
  /**
   * This object represents the property of a vCard/vCalendar/iCalendar item,
   * including its value and parameters.
   *
   * @version $Id: Property.java,v 1.6 2008-04-10 10:42:22 mauro Exp $
   */
  public class Property {
  
      //--------------------------------------------------------------- Properties
      
      protected Object propertyValue;
      protected String altrep;
      protected String cn;
      protected String cutype;
      protected String delegatedFrom;
      protected String delegatedTo;
      protected String dir;
      protected String encoding;
      protected String language;
      protected String member;
      protected String partstat;
      protected String related;
      protected String sentby;
      protected String value;
      protected Map<String, String> xParams;
      protected String tag;
      protected String group;
      protected String chrset;
      protected String type;
  
      /**
       * Returns the value of this property "as it is".
       *
       * @return the value of this property as any Object
       */
      public Object getPropertyValue() {
          return propertyValue;
      }
  
      /**
       * Returns the value of this property as a String. If the property value
       * is not of type String, String.valueOf() is invoked to translate the
       * object into its string representation.
       *
       * @return the value of this property as a String object
       */
      public String getPropertyValueAsString() {
          if (propertyValue == null) {
              return null;
          }
          if (propertyValue instanceof String) {
              return (String)propertyValue;
          }
          return String.valueOf(propertyValue);
      }
  
      /**
       * Returns parameter ENCODING that is used to specify an alternate
       * encoding for a value.
       * This should be used only for properties like PHOTO or KEY.
       *
       * @return the encoding parameter of this property
       */
      public String getEncoding() {
          return encoding;
      }
  
      /**
       * Returns parameter LANGUAGE that is used to identify data in multiple
       * languages.
       *
       * @return the language parameter of this property
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getLanguage() {
          return language;
      }
  
      /**
       * Returns parameter VALUE that is used to identify the value data type and 
       * format of the value.
       *
       * @return the value parameter of this property
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getValue() {
          return value;
      }
  
      /**
       * Returns an alternate text representation for the property value.
       *
       * @return an alternate text representation
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getAltrep() {
          return altrep;
      }
  
      /**
       * Returns the common name that is associated with the calendar user
       * specified by this property.
       *
       * @return a common name
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getCn() {
          return cn;
      }
  
      /**
       * Returns the type of calendar user specified by this property.
       *
       * @return the type of calendar user
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getCutype() {
          return cutype;
      }
  
      /**
       * Returns the calendar users that have delegated their participation to
       * the calendar user specified by this property.
       *
       * @return the delegators
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getDelegatedFrom() {
          return delegatedFrom;
      }
  
      /**
       * Returns the calendar users to whom the calendar user specified by this
       * property has delegated participation.
       *
       * @return the delegatees
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getDelegatedTo() {
          return delegatedTo;
      }
  
      /**
       * Returns the reference to a directory entry associated with the calendar
       * user specified by this property.
       *
       * @return the reference to a directory entry
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getDir() {
          return dir;
      }
  
      /**
       * Returns the group or list membership of the calendar user specified by
       * this property.
       *
       * @return the group or list membership
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getMember() {
          return member;
      }
  
      /**
       * Returns the partecipation status of the calendar user specified by
       * this property.
       *
       * @return the partecipation status
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getPartstat() {
          return partstat;
      }
  
      /**
       * Returns the relationship of the alarm trigger with respect to the start
       * or end of the calendar component.
       *
       * @return the relationship of the alarm trigger
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getRelated() {
          return related;
      }
  
      /**
       * Returns the calendar user that is acting on behalf of the calendar user
       * specified by this property.
       *
       * @return the calendar user that is acting on behalf of the calendar user
       *         specified by this property
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getSentby() {
          return sentby;
      }
  
      /**
       * Returns the group parameter of this property. The group parameter is used
       * to group related attributes together.
       *
       * @return the group parameter of this property
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getGroup() {
          return group;
      }
  
      /**
       * Returns the default character set used within the body part.
       *
       * @return the charset parameter of this property
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getCharset() {
          return chrset;
      }
  
      /**
       * Returns the type parameter of this property.
       * This should be used only for properties like PHOTO or KEY.
       *
       * @return the type parameter of this property
       */
      public String getType() {
          return type;
      }
  
      /**
       * Gets the custom parameters.
       * 
       * @return a HashMap containing all custom parameters (names and values)
       * 
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public HashMap<String, String> getXParams() {
          return (HashMap) xParams; // Ugly but necessary
      }
      
      /**
       * Sets the custom parameter
       * 
       * @param xParams a Map containing all custom parameters (names and values)
       * 
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public void setXParams(Map<String, String> xParams) {
          if(this.xParams == null) {
              this.xParams = new HashMap<String, String>();
          }
          this.xParams.clear();
          this.xParams.putAll(xParams);
      }
  
      /**
       * Returns the TAG of this property.
       * 
       * @return the tag parameter of this property
       * 
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public String getTag() {
          return this.tag;
      }
  
      /**
       * Sets the TAG of this property.
       * 
       * @param tag the tag to set
       * 
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public void setTag(String tag){
          this.tag = tag;
      }
  
      /**
       * Sets the encoding parameter of this property.
       * This should be used only for properties like PHOTO or KEY.
       *
       * @param encoding the encoding to set
       */
      public void setEncoding(String encoding) {
          this.encoding = encoding;
      }
  
      /**
       * Sets the language parameter of this property.
       *
       * @param language the language to set
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public void setLanguage(String language) {
          this.language = language;
      }
  
      /**
       * Sets the value parameter of this property.
       *
       * @param value the value to set
       *
       * @deprecated Since version 6.5, a Property should not contain anything but
       *             the propertyValue.
       */
      public void setValue(String value) {
          this.value = value;
      }
  
  
      /**
       * Sets the property value. Blank spaces and tabs will be stripped from its
       * end if it is a string.
       *
       * @param propertyValue the property value to set
       */
      public void setPropertyValue(Object propertyValue) {
          
  