code: private void writeSimple(String currentIndent, String tagName, StringBuilder attrs, Class<?> declaredType, Object value) throws IOException {
          Class<?> effectiveType;
          if (declaredType == Object.class) {
              Class<?> realType = value.getClass();
              if (realType != String.class) {
                  effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();
                  String typeStr = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);
                  appendAttribute(attrs, TYPE, typeStr);
              } else {
                  effectiveType = realType;
              }
          } else if (settings.getConverter().isConvertible(declaredType) == false) {
              effectiveType = settings.getConverter().findTypedConverter(value.getClass()).getEffectiveType();
              String typeStr = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);
              appendAttribute(attrs, TYPE, typeStr);
          } else {
              effectiveType = declaredType;
          }
          try {
              String converted = settings.getConverter().convertToString(effectiveType, value);
              if (converted == null) {
                  throw new IllegalArgumentException("Unable to write because converter returned a null string: " + value);
              }
              output.append(currentIndent).append('<').append(tagName).append(attrs).append('>');
              appendEncoded(converted);
              output.append('<').append('/').append(tagName).append('>').append(settings.getNewLine());
          } catch (RuntimeException ex) {
              throw new IllegalArgumentException("Unable to convert type " + effectiveType.getName() + " declared as " + declaredType.getName(), ex);
          }
      }
docs: -----------------------------------------------------------------------