M
- the starting data format for the model to be inputedpublic class XmlWriter<M> extends AutoBeanWriter<M,String>
AutoBeanWriter
that outputs XML. The PropertyName
annotation is read as the path to
the node to write out the values in essentially the same way that XmlReader
works, though conditionals
are not allowed.
XML does not have a concept of null
, so instead this writer omits any null values. In most cases this will
yield the same contents on reading the values back out again, as the lack of a value can be understood to mean
null, but one exception is using a null in a collection. A List with a null entry will have that entry completely
skipped by this writer.Constructor and Description |
---|
XmlWriter(AutoBeanFactory factory,
Class<M> clazz,
String rootTag)
Creates a new XML writer that can format an object into XML.
|
Modifier and Type | Method and Description |
---|---|
String |
write(M model)
Converts a source model to its equivalent target type.
|
getAutoBean
public String write(M model)
DataWriter
model
- the source modelCopyright © 2018. All rights reserved.