code: private void writeBean(String currentIndent, String tagName, StringBuilder attrs, Class<?> propType, Bean value) throws IOException {
          if (value == null) {
              throw new IllegalArgumentException("Bean cannot be null");
          }
          output.append(currentIndent).append('<').append(tagName).append(attrs);
          if (value.getClass() != propType) {
              String typeStr = SerTypeMapper.encodeType(value.getClass(), settings, basePackage, knownTypes);
              appendAttribute(output, TYPE, typeStr);
          }
          if (willWriteBean(value)) {
              output.append('>').append(settings.getNewLine());
              writeBean(value, currentIndent + settings.getIndent());
              output.append(currentIndent).append('<').append('/').append(tagName).append('>').append(settings.getNewLine());
          } else {
              output.append('/').append('>').append(settings.getNewLine());
          }
      }
docs: -----------------------------------------------------------------------