Class XmlNodeConverter

java.lang.Object
io.lighty.codecs.util.XmlNodeConverter
All Implemented Interfaces:
NodeConverter

public class XmlNodeConverter extends Object implements NodeConverter
The implementation of NodeConverter which serializes and deserializes binding independent representation into/from XML representation.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    XmlNodeConverter(org.opendaylight.yangtools.yang.model.api.EffectiveModelContext effectiveModelContext)
    The only constructor will create an instance of XmlNodeConverter with the given EffectiveModelContext.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode
    deserialize(org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference inference, Reader inputData)
    Deserializes a given XML input data into NormalizedNode.
    org.opendaylight.yangtools.yang.model.api.EffectiveModelContext
     
    serializeData(org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference inference, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode normalizedNode)
    Serializes the given NormalizedNode into its Writer representation.
    serializeRpc(org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference inference, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode normalizedNode)
    Serializes the input/output NormalizedNode of a RPC into its string representation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XmlNodeConverter

      public XmlNodeConverter(org.opendaylight.yangtools.yang.model.api.EffectiveModelContext effectiveModelContext)
      The only constructor will create an instance of XmlNodeConverter with the given EffectiveModelContext. 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 given NormalizedNode into its Writer representation.
      Specified by:
      serializeData in interface NodeConverter
      Parameters:
      inference - SchemaInferenceStack.Inference pointing to normalizedNode's parent
      normalizedNode - 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: NodeConverter
      Serializes the input/output NormalizedNode of a RPC into its string representation.
      Specified by:
      serializeRpc in interface NodeConverter
      Parameters:
      inference - SchemaInferenceStack.Inference of input/output container of the RPC
      normalizedNode - 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 into NormalizedNode.

      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:
      deserialize in interface NodeConverter
      Parameters:
      inference - SchemaInferenceStack.Inference pointing to a node we are trying to deserialize
      inputData - 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:
      getModelContext in interface NodeConverter