if(beanMetadata == null) {
BeanRegistrationException.throwUnregisteredBeanInstanceException(bean);
}
BeanWriter beanWriter = beanMetadata.getWriter();
if(beanMetadata.getPreText() != null) {
environment.getOut().write(beanMetadata.getPreText());
}
if(indent > 0) {
StringWriter beanWriteBuffer = new StringWriter();
beanWriteBuffer.write('\n');
beanWriter.write(bean, beanWriteBuffer, model);
environment.getOut().write(XmlUtil.indent(beanWriteBuffer.toString(), indent));
} else {
beanWriter.write(bean, environment.getOut(), model);
}
}