code: public static String objectToString(Object value) {
      if (value == null) {
        return null;
      }
      if (value instanceof String) {
        return (String)value;
      }
      if (value instanceof String[]) {
        return StringUtils.join(encodeString((String[])value), ARRAY_DELIMITER);
      }
      else if (value instanceof Integer) {
        return Integer.toString((Integer)value);
      }
      else if (value instanceof Long) {
        return Long.toString((Long)value);
      }
      else if (value instanceof Double) {
        return Double.toString((Double)value);
      }
      else if (value instanceof Boolean) {
        return Boolean.toString((Boolean)value);
      }
      else if (value instanceof Map) {
        Map<?, ?> map = (Map<?, ?>)value;
        StringBuilder stringValue = new StringBuilder();
        Map.Entry<?, ?>[] entries = Iterators.toArray(map.entrySet().iterator(), Map.Entry.class);
        for (int i = 0; i < entries.length; i++) {
          Map.Entry<?, ?> entry = entries[i];
          String entryKey = encodeString(Objects.toString(entry.getKey(), ""));
          String entryValue = encodeString(Objects.toString(entry.getValue(), ""));
          stringValue.append(entryKey).append(KEY_VALUE_DELIMITER).append(entryValue);
          if (i < entries.length - 1) {
            stringValue.append(ARRAY_DELIMITER);
          }
        }
        return stringValue.toString();
      }
      throw new IllegalArgumentException("Unsupported type: " + value.getClass().getName());
    }
docs: Converts a typed value to it's string representation.
  @param value Typed value
  @return String value