Package io.kojan.xml
Class XMLDumperImpl
java.lang.Object
io.kojan.xml.XMLDumperImpl
- All Implemented Interfaces:
XMLDumper
An implementation of
XMLDumper
using Java StAX API.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final XMLStreamWriter
private int
private static final XMLOutputFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate <Type,
Bean, Value>
void(package private) <Type,
Bean>
voiddumpDocument
(Entity<Type, Bean> rootEntity, Type value) private void
void
Writes a sequence that ends previously started XML element.<Type,
Bean>
voiddumpEntity
(Entity<Type, Bean> entity, Type value) Serializes givenEntity
into XML form.private void
void
dumpStartElement
(String tag) Writes a sequence that starts an XML element with given tag.void
Writes XML text content.private void
indent()
private void
newLine()
-
Field Details
-
XML_OUTPUT_FACTORY
-
cursor
-
indent
private int indent
-
-
Constructor Details
-
XMLDumperImpl
XMLDumperImpl(Writer writer) throws XMLException - Throws:
XMLException
-
-
Method Details
-
indent
- Throws:
XMLStreamException
-
newLine
- Throws:
XMLStreamException
-
dumpStartDocument
- Throws:
XMLStreamException
-
dumpEndDocument
- Throws:
XMLStreamException
-
dumpStartElement
Description copied from interface:XMLDumper
Writes a sequence that starts an XML element with given tag.- Specified by:
dumpStartElement
in interfaceXMLDumper
- Parameters:
tag
- element tag name- Throws:
XMLException
- in case exception occurs during XML serialization
-
dumpEndElement
Description copied from interface:XMLDumper
Writes a sequence that ends previously started XML element.- Specified by:
dumpEndElement
in interfaceXMLDumper
- Throws:
XMLException
- in case exception occurs during XML serialization
-
dumpText
Description copied from interface:XMLDumper
Writes XML text content.- Specified by:
dumpText
in interfaceXMLDumper
- Parameters:
text
- text content to write- Throws:
XMLException
- in case exception occurs during XML serialization
-
doDump
private <Type,Bean, void doDumpValue> (Property<Type, Bean, throws XMLExceptionValue> property, Type object) - Throws:
XMLException
-
dumpEntity
Description copied from interface:XMLDumper
Serializes givenEntity
into XML form.- Specified by:
dumpEntity
in interfaceXMLDumper
- Type Parameters:
Type
- data type of entityBean
- type of bean associated with the entity- Parameters:
entity
- the entity type to serializevalue
- the object to serialize- Throws:
XMLException
- in case exception occurs during XML serialization
-
dumpDocument
- Throws:
XMLException
-