@Override
  public void appendValue(
      T instance,
      Appendable buffy,
      boolean needsEscaping,
      TranslationContext serializationContext,
      Format format)
      throws IOException {
    String instanceString = "";
    if (instance != null && serializationContext != null)
      instanceString = marshall(instance, serializationContext); // andruid 1/4/10
    // instance.toString();
    if (needsEscaping) {
      switch (format) {
        case JSON:
          buffy.append(JSONObject.escape(instanceString));
          ;
          break;
        case XML:
          XMLTools.escapeXML(buffy, instanceString);
          break;
        default:
          XMLTools.escapeXML(buffy, instanceString);
          break;
      }

    } else buffy.append(instanceString);
  }
  /**
   * Append the String directly, unless it needs escaping, in which case, call escapeXML.
   *
   * @param instance
   * @param buffy
   * @param needsEscaping
   */
  @Override
  public void appendValue(
      T instance,
      StringBuilder buffy,
      boolean needsEscaping,
      TranslationContext serializationContext) {

    String instanceString = marshall(instance, serializationContext); // instance.toString();
    if (needsEscaping) XMLTools.escapeXML(buffy, instanceString);
    else buffy.append(instanceString);
  }