T - The typepublic abstract class AbstractXmlWriter<T> extends AbstractWriter<T> implements XmlWriter<T>
| Modifier and Type | Field and Description |
|---|---|
protected XmlRegistry |
xmlRegistry |
handlerManager, idMap, logger| Modifier | Constructor and Description |
|---|---|
protected |
AbstractXmlWriter() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
appendModel(XmlBuilder xmlBuilder,
T model) |
protected abstract String |
modelName() |
protected String |
modelsName() |
String |
toXml(List<T> models)
Serializes the specified models to XML.
|
String |
toXml(List<T> models,
String rootElement)
Serializes the specified models to XML using the specified name for the
root element.
|
String |
toXml(List<T> models,
String rootElement,
String nestedRootElement)
Serializes the specified models to XML using the specified names for the
root and nested elements.
|
String |
toXml(T model)
Serializes the specified model to XML.
|
String |
toXml(T model,
String rootElement)
Serializes the specified model to XML using the specified name for the
root element.
|
addModelWriteHandler, fireEventclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddModelWriteHandlerprotected final XmlRegistry xmlRegistry
public String toXml(List<T> models)
XmlWriterGiven you want to serialize a list of books:
List<Book> books = ...; XmlWriter<Book> xmlWriter = ...; String xml = xmlWriter.toXml(books);Then the xml will have the following structure:
<books>
<book>
...
</book>
...
</books>
public String toXml(List<T> models, String rootElement)
XmlWriterpublic String toXml(List<T> models, String rootElement, String nestedRootElement)
XmlWriterpublic String toXml(T model)
XmlWriterGiven you want to serialize a book:
Book book = ...; XmlWriter<Book> xmlWriter = ...; String xml = xmlWriter.toXml(book);Then the xml will have the following structure:
<book>
...
</book>
public String toXml(T model, String rootElement)
XmlWriterpublic abstract void appendModel(XmlBuilder xmlBuilder, T model)
protected abstract String modelName()
protected String modelsName()
Copyright © 2012 Harald Pehl. All Rights Reserved.