Package io.lighty.codecs.util
Class XmlNodeConverter
java.lang.Object
io.lighty.codecs.util.XmlNodeConverter
- All Implemented Interfaces:
NodeConverter
The implementation of
NodeConverter which serializes and deserializes binding independent
representation into/from XML representation.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionXmlNodeConverter(org.opendaylight.yangtools.yang.model.api.EffectiveModelContext effectiveModelContext) The only constructor will create an instance ofXmlNodeConverterwith the givenEffectiveModelContext. -
Method Summary
Modifier and TypeMethodDescriptionorg.opendaylight.yangtools.yang.data.api.schema.NormalizedNodedeserialize(org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference inference, Reader inputData) Deserializes a given XML input data intoNormalizedNode.org.opendaylight.yangtools.yang.model.api.EffectiveModelContextserializeData(org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference inference, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode normalizedNode) Serializes the givenNormalizedNodeinto itsWriterrepresentation.serializeRpc(org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference inference, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode normalizedNode) Serializes the input/outputNormalizedNodeof a RPC into its string representation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.lighty.codecs.util.NodeConverter
deserialize, deserialize, deserialize, serializeData, serializeData, serializeData, serializeRpc, serializeRpc
-
Constructor Details
-
XmlNodeConverter
public XmlNodeConverter(org.opendaylight.yangtools.yang.model.api.EffectiveModelContext effectiveModelContext) The only constructor will create an instance ofXmlNodeConverterwith the givenEffectiveModelContext. This effective model context will be used for proper RPC and Node resolution- Parameters:
effectiveModelContext- initial effective model context
-
-
Method Details
-
serializeData
public Writer serializeData(org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference inference, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode normalizedNode) throws SerializationException Serializes the givenNormalizedNodeinto itsWriterrepresentation.- Specified by:
serializeDatain interfaceNodeConverter- Parameters:
inference-SchemaInferenceStack.Inferencepointing to normalizedNode's parentnormalizedNode- normalized node to serialize- Returns:
Writer- Throws:
SerializationException- if something goes wrong with serialization
-
serializeRpc
public Writer serializeRpc(org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference inference, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode normalizedNode) throws SerializationException Description copied from interface:NodeConverterSerializes the input/outputNormalizedNodeof a RPC into its string representation.- Specified by:
serializeRpcin interfaceNodeConverter- Parameters:
inference-SchemaInferenceStack.Inferenceof input/output container of the RPCnormalizedNode- normalized nodes to be serialized- Returns:
- string representation of the given nodes starting with input or output tag
- Throws:
SerializationException- thrown in case serialization fails.
-
deserialize
public org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode deserialize(org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference inference, Reader inputData) throws DeserializationException Deserializes a given XML input data intoNormalizedNode.In the case of deserializing multiple top level list entries, entries are expected to be wrapped in
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">.- Specified by:
deserializein interfaceNodeConverter- Parameters:
inference-SchemaInferenceStack.Inferencepointing to a node we are trying to deserializeinputData- Reader containing input JSON data describing node to deserialize- Returns:
- deserialized
NormalizedNode - Throws:
DeserializationException- is thrown in case of an error during deserialization
-
getModelContext
public org.opendaylight.yangtools.yang.model.api.EffectiveModelContext getModelContext()- Specified by:
getModelContextin interfaceNodeConverter
-