public final class OutlineSerializer extends Object
Outline
/ OutlineNode
to an XML stream. See
marshall(OutlineNode, OutputStream)
and unmarshall(InputStream)
.
Note
When using custom instructions, it is necessary to register an appropriate
InstructionConverter
via registerInstructionConverter(InstructionConverter)
. The
class of the SerializableInstruction
the converter can handle will be automatically used
in the JAXBContext.
If needed, additional classes can be registered for the JAXBContext
via
registerAdditionalJAXBContextClasses(Class...)
.
Modifier and Type | Method and Description |
---|---|
static void |
marshall(OutlineNode<?> node,
OutputStream os)
Marshalls the given
Outline / OutlineNode to an XML output stream. |
static void |
registerAdditionalJAXBContextClasses(Class<?>... additionalContext)
Registers classes to be used in addition to the default classes in the
JAXBContext . |
static void |
registerInstructionConverter(InstructionConverter<? extends Instruction,? extends SerializableInstruction> converter)
Registers an
InstructionConverter to convert a custom instruction type. |
static OutlineNode<?> |
unmarshall(InputStream is)
Unmarshalls an
Outline / OutlineNode from the given XML stream. |
public static void registerAdditionalJAXBContextClasses(Class<?>... additionalContext)
JAXBContext
. By
default, the context contains the "Serializable*"-classes from this package.
Generally it is not necessary to register SerializableInstruction
s which are handled by
registered InstructionConverter
s. All SerializableInstruction
-sub classes which
are handled by the registered converters will be used in the JAXBContext automatically.
additionalContext
- the additional contextpublic static void registerInstructionConverter(InstructionConverter<? extends Instruction,? extends SerializableInstruction> converter)
InstructionConverter
to convert a custom instruction type. The type of the
SerializableInstruction
will be used automatically when the JAXBContext
is
being created. There is no need to register that class manually.converter
- the converterpublic static void marshall(OutlineNode<?> node, OutputStream os) throws JAXBException
Outline
/ OutlineNode
to an XML output stream.
Note
When using custom instructions, 2 things have to be done:
registerAdditionalJAXBContextClasses(Class...)
InstructionConverter
via
registerInstructionConverter(InstructionConverter)
for the instruction
typenode
- the node to store as XMLos
- the output streamJAXBException
public static OutlineNode<?> unmarshall(InputStream is) throws JAXBException
Outline
/ OutlineNode
from the given XML stream.
Note
When using custom instructions, 2 things have to be done:
registerAdditionalJAXBContextClasses(Class...)
InstructionConverter
via
registerInstructionConverter(InstructionConverter)
for the instruction
typeis
- the stream to read XML fromJAXBException
Copyright © 2024 levigo holding gmbh. All rights reserved.