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 XMLStreamWriterprivate intprivate 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 voidvoidWrites a sequence that ends previously started XML element.<Type,Bean>
voiddumpEntity(Entity<Type, Bean> entity, Type value) Serializes givenEntityinto XML form.private voidvoiddumpStartElement(String tag) Writes a sequence that starts an XML element with given tag.voidWrites XML text content.private voidindent()private voidnewLine()
-
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:XMLDumperWrites a sequence that starts an XML element with given tag.- Specified by:
dumpStartElementin interfaceXMLDumper- Parameters:
tag- element tag name- Throws:
XMLException- in case exception occurs during XML serialization
-
dumpEndElement
Description copied from interface:XMLDumperWrites a sequence that ends previously started XML element.- Specified by:
dumpEndElementin interfaceXMLDumper- Throws:
XMLException- in case exception occurs during XML serialization
-
dumpText
Description copied from interface:XMLDumperWrites XML text content.- Specified by:
dumpTextin 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:XMLDumperSerializes givenEntityinto XML form.- Specified by:
dumpEntityin 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
-