public class JsonNodeConverter extends Object implements NodeConverter
NodeConverter
which serializes and deserializes binding independent
representation into/from JSON representation.XmlNodeConverter
Constructor and Description |
---|
JsonNodeConverter(org.opendaylight.yangtools.yang.model.api.SchemaContext schemaContext)
The only available constructor.
|
Modifier and Type | Method and Description |
---|---|
org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> |
deserialize(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode,
Reader inputData)
Deserializes the given JSON representation into
NormalizedNode s. |
Writer |
serializeData(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode,
org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> normalizedNode)
This method serializes the provided
NormalizedNode into its JSON representation. |
Writer |
serializeRpc(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode,
org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> normalizedNode)
This method serializes the
NormalizedNode which represents the input or output of an RPC. |
public JsonNodeConverter(org.opendaylight.yangtools.yang.model.api.SchemaContext schemaContext)
schemaContext
- to be usedpublic Writer serializeData(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> normalizedNode) throws SerializationException
NormalizedNode
into its JSON representation.serializeData
in interface NodeConverter
schemaNode
- SchemaNode
may be obtained via
ConverterUtils.getSchemaNode(SchemaContext, QName)
or
ConverterUtils.getSchemaNode(SchemaContext, String, String, String)
normalizedNode
- NormalizedNode
to be serializedStringWriter
SerializationException
- if there was a problem during writing JSON dataConverterUtils.getSchemaNode(SchemaContext, QName)
public Writer serializeRpc(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> normalizedNode) throws SerializationException
NormalizedNode
which represents the input or output of an RPC.serializeRpc
in interface NodeConverter
schemaNode
- the input or output SchemaNode
of the RPCnormalizedNode
- serialized binding independent dataNormalizedNode
SerializationException
- if an IOException
occurs during serializationConverterUtils.rpcAsInput(XmlElement)
,
ConverterUtils.rpcAsOutput(XmlElement)
,
ConverterUtils.getRpcQName(XmlElement)
public org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> deserialize(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode, Reader inputData) throws SerializationException
NormalizedNode
s.deserialize
in interface NodeConverter
schemaNode
- a correct SchemaNode
may be obtained via
ConverterUtils.getSchemaNode(SchemaContext, QName)
or
ConverterUtils.getSchemaNode(SchemaContext, String, String, String)
or
ConverterUtils.loadRpc(SchemaContext, QName)
depending on the input/outputinputData
- reader containing input data.NormalizedNode
representation of input dataSerializationException
- if there was a problem during deserialization or reading the input
dataConverterUtils.loadRpc(SchemaContext, QName)
,
ConverterUtils.rpcAsInput(XmlElement)
,
ConverterUtils.rpcAsOutput(XmlElement)
Copyright © 2020. All rights reserved.