java.lang.Object
org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, org.opendaylight.yangtools.concepts.ExtensibleObject<org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter,org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterExtension>, org.opendaylight.yangtools.concepts.ObjectExtension<org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter,org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterExtension>, org.opendaylight.yangtools.rfc8528.data.api.StreamWriterMountPointExtension, org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter, org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterExtension

public abstract class JSONNormalizedNodeStreamWriter extends Object implements org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter, org.opendaylight.yangtools.rfc8528.data.api.StreamWriterMountPointExtension
This implementation will create JSON output as output stream.

Values of leaf and leaf-list are NOT translated according to codecs.

  • Field Summary

    Fields inherited from interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter

    UNKNOWN_SIZE
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    createExclusiveWriter(JSONCodecFactory codecFactory, com.google.gson.stream.JsonWriter jsonWriter)
    Create a new stream writer, which writes to the specified output stream.
    static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    createExclusiveWriter(JSONCodecFactory codecFactory, com.google.gson.stream.JsonWriter jsonWriter, @Nullable org.opendaylight.yangtools.yang.common.XMLNamespace initialNs)
    Create a new stream writer, which writes to the specified output stream.
    static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    createExclusiveWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.EffectiveStatementInference rootNode, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
    Create a new stream writer, which writes to the specified output stream.
    static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    createExclusiveWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.SchemaPath path, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use one of the alternative overloads
    static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    createExclusiveWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute path, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
    Create a new stream writer, which writes to the specified output stream.
    static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    createNestedWriter(JSONCodecFactory codecFactory, com.google.gson.stream.JsonWriter jsonWriter)
    Create a new stream writer, which writes to the specified output stream.
    static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    createNestedWriter(JSONCodecFactory codecFactory, com.google.gson.stream.JsonWriter jsonWriter, @Nullable org.opendaylight.yangtools.yang.common.XMLNamespace initialNs)
    Create a new stream writer, which writes to the specified output stream.
    static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    createNestedWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.EffectiveStatementInference rootNode, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
    Create a new stream writer, which writes to the specified output stream.
    static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    createNestedWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.SchemaPath path, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use one of the alternative overloads
    static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    createNestedWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute path, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
    Create a new stream writer, which writes to the specified output stream.
    void
     
    final void
     
    final void
     
    com.google.common.collect.ClassToInstanceMap<org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterExtension>
     
    void
     
    final boolean
    startAnydataNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, Class<?> objectModel)
     
    final boolean
    startAnyxmlNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, Class<?> objectModel)
     
    final void
    startAugmentationNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier identifier)
     
    final void
    startChoiceNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
     
    final void
    startContainerNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
     
    void
    startLeafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name)
     
    final void
    startLeafSet(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
     
    void
    startLeafSetEntryNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue<?> name)
     
    final void
    startMapEntryNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, int childSizeHint)
     
    final void
    startMapNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
     
    final org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    startMountPoint(org.opendaylight.yangtools.rfc8528.data.api.MountPointIdentifier mountId, org.opendaylight.yangtools.rfc8528.data.api.MountPointContext mountCtx)
     
    final void
    startOrderedLeafSet(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
     
    final void
    startOrderedMapNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
     
    final void
    startUnkeyedList(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
     
    final void
    startUnkeyedListItem(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter

    close, nextDataSchemaNode
  • Method Details

    • createExclusiveWriter

      public static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter createExclusiveWriter(JSONCodecFactory codecFactory, com.google.gson.stream.JsonWriter jsonWriter)
      Create a new stream writer, which writes to the specified output stream.

      The codec factory can be reused between multiple writers.

      Returned writer is exclusive user of JsonWriter, which means it will start top-level JSON element and ends it.

      This instance of writer can be used only to emit one top level element, otherwise it will produce incorrect JSON. Closing this instance will close the writer too.

      Parameters:
      codecFactory - JSON codec factory
      jsonWriter - JsonWriter
      Returns:
      A stream writer instance
    • createExclusiveWriter

      public static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter createExclusiveWriter(JSONCodecFactory codecFactory, com.google.gson.stream.JsonWriter jsonWriter, @Nullable org.opendaylight.yangtools.yang.common.XMLNamespace initialNs)
      Create a new stream writer, which writes to the specified output stream.

      The codec factory can be reused between multiple writers.

      Returned writer is exclusive user of JsonWriter, which means it will start top-level JSON element and ends it.

      This instance of writer can be used only to emit one top level element, otherwise it will produce incorrect JSON. Closing this instance will close the writer too.

      Parameters:
      codecFactory - JSON codec factory
      jsonWriter - JsonWriter
      initialNs - Initial namespace, can be null
      Returns:
      A stream writer instance
    • createExclusiveWriter

      @Deprecated(since="9.0.1", forRemoval=true) public static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter createExclusiveWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.SchemaPath path, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use one of the alternative overloads
      Create a new stream writer, which writes to the specified output stream.

      The codec factory can be reused between multiple writers.

      Returned writer is exclusive user of JsonWriter, which means it will start top-level JSON element and ends it.

      This instance of writer can be used only to emit one top level element, otherwise it will produce incorrect JSON. Closing this instance will close the writer too.

      Parameters:
      codecFactory - JSON codec factory
      path - Schema Path
      initialNs - Initial namespace
      jsonWriter - JsonWriter
      Returns:
      A stream writer instance
    • createExclusiveWriter

      public static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter createExclusiveWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.EffectiveStatementInference rootNode, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
      Create a new stream writer, which writes to the specified output stream.

      The codec factory can be reused between multiple writers.

      Returned writer is exclusive user of JsonWriter, which means it will start top-level JSON element and ends it.

      This instance of writer can be used only to emit one top level element, otherwise it will produce incorrect JSON. Closing this instance will close the writer too.

      Parameters:
      codecFactory - JSON codec factory
      rootNode - Root node inference
      initialNs - Initial namespace
      jsonWriter - JsonWriter
      Returns:
      A stream writer instance
    • createExclusiveWriter

      public static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter createExclusiveWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute path, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
      Create a new stream writer, which writes to the specified output stream.

      The codec factory can be reused between multiple writers.

      Returned writer is exclusive user of JsonWriter, which means it will start top-level JSON element and ends it.

      This instance of writer can be used only to emit one top level element, otherwise it will produce incorrect JSON. Closing this instance will close the writer too.

      Parameters:
      codecFactory - JSON codec factory
      path - Schema Path
      initialNs - Initial namespace
      jsonWriter - JsonWriter
      Returns:
      A stream writer instance
    • createNestedWriter

      public static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter createNestedWriter(JSONCodecFactory codecFactory, com.google.gson.stream.JsonWriter jsonWriter)
      Create a new stream writer, which writes to the specified output stream.

      The codec factory can be reused between multiple writers.

      Returned writer can be used emit multiple top level element, but does not start / close parent JSON object, which must be done by user providing jsonWriter instance in order for JSON to be valid. Closing this instance will not close the wrapped writer; the caller must take care of that.

      Parameters:
      codecFactory - JSON codec factory
      jsonWriter - JsonWriter
      Returns:
      A stream writer instance
    • createNestedWriter

      public static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter createNestedWriter(JSONCodecFactory codecFactory, com.google.gson.stream.JsonWriter jsonWriter, @Nullable org.opendaylight.yangtools.yang.common.XMLNamespace initialNs)
      Create a new stream writer, which writes to the specified output stream.

      The codec factory can be reused between multiple writers.

      Returned writer can be used emit multiple top level element, but does not start / close parent JSON object, which must be done by user providing jsonWriter instance in order for JSON to be valid. Closing this instance will not close the wrapped writer; the caller must take care of that.

      Parameters:
      codecFactory - JSON codec factory
      initialNs - Initial namespace
      jsonWriter - JsonWriter
      Returns:
      A stream writer instance
    • createNestedWriter

      @Deprecated(since="9.0.1", forRemoval=true) public static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter createNestedWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.SchemaPath path, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use one of the alternative overloads
      Create a new stream writer, which writes to the specified output stream.

      The codec factory can be reused between multiple writers.

      Returned writer can be used emit multiple top level element, but does not start / close parent JSON object, which must be done by user providing jsonWriter instance in order for JSON to be valid. Closing this instance will not close the wrapped writer; the caller must take care of that.

      Parameters:
      codecFactory - JSON codec factory
      path - Schema Path
      initialNs - Initial namespace
      jsonWriter - JsonWriter
      Returns:
      A stream writer instance
    • createNestedWriter

      public static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter createNestedWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute path, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
      Create a new stream writer, which writes to the specified output stream.

      The codec factory can be reused between multiple writers.

      Returned writer can be used emit multiple top level element, but does not start / close parent JSON object, which must be done by user providing jsonWriter instance in order for JSON to be valid. Closing this instance will not close the wrapped writer; the caller must take care of that.

      Parameters:
      codecFactory - JSON codec factory
      path - Schema Path
      initialNs - Initial namespace
      jsonWriter - JsonWriter
      Returns:
      A stream writer instance
    • createNestedWriter

      public static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter createNestedWriter(JSONCodecFactory codecFactory, org.opendaylight.yangtools.yang.model.api.EffectiveStatementInference rootNode, org.opendaylight.yangtools.yang.common.XMLNamespace initialNs, com.google.gson.stream.JsonWriter jsonWriter)
      Create a new stream writer, which writes to the specified output stream.

      The codec factory can be reused between multiple writers.

      Returned writer can be used emit multiple top level element, but does not start / close parent JSON object, which must be done by user providing jsonWriter instance in order for JSON to be valid. Closing this instance will not close the wrapped writer; the caller must take care of that.

      Parameters:
      codecFactory - JSON codec factory
      rootNode - Root node inference
      initialNs - Initial namespace
      jsonWriter - JsonWriter
      Returns:
      A stream writer instance
    • getExtensions

      public com.google.common.collect.ClassToInstanceMap<org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterExtension> getExtensions()
      Specified by:
      getExtensions in interface org.opendaylight.yangtools.concepts.ExtensibleObject<org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter,org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterExtension>
    • startLeafNode

      public void startLeafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name) throws IOException
      Specified by:
      startLeafNode in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • startLeafSet

      public final void startLeafSet(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
      Specified by:
      startLeafSet in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • startLeafSetEntryNode

      public void startLeafSetEntryNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue<?> name) throws IOException
      Specified by:
      startLeafSetEntryNode in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • startOrderedLeafSet

      public final void startOrderedLeafSet(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
      Specified by:
      startOrderedLeafSet in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • startContainerNode

      public final void startContainerNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
      Specified by:
      startContainerNode in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • startUnkeyedList

      public final void startUnkeyedList(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
      Specified by:
      startUnkeyedList in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • startUnkeyedListItem

      public final void startUnkeyedListItem(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
      Specified by:
      startUnkeyedListItem in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • startMapNode

      public final void startMapNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
      Specified by:
      startMapNode in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • startMapEntryNode

      public final void startMapEntryNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, int childSizeHint) throws IOException
      Specified by:
      startMapEntryNode in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • startOrderedMapNode

      public final void startOrderedMapNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
      Specified by:
      startOrderedMapNode in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • startChoiceNode

      public final void startChoiceNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
      Specified by:
      startChoiceNode in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    • startAugmentationNode

      public final void startAugmentationNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier identifier)
      Specified by:
      startAugmentationNode in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
    • startAnydataNode

      public final boolean startAnydataNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, Class<?> objectModel) throws IOException
      Specified by:
      startAnydataNode in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • startMountPoint

      public final org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter startMountPoint(org.opendaylight.yangtools.rfc8528.data.api.MountPointIdentifier mountId, org.opendaylight.yangtools.rfc8528.data.api.MountPointContext mountCtx) throws IOException
      Specified by:
      startMountPoint in interface org.opendaylight.yangtools.rfc8528.data.api.StreamWriterMountPointExtension
      Throws:
      IOException
    • startAnyxmlNode

      public final boolean startAnyxmlNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, Class<?> objectModel) throws IOException
      Specified by:
      startAnyxmlNode in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • endNode

      public final void endNode() throws IOException
      Specified by:
      endNode in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • flush

      public final void flush() throws IOException
      Specified by:
      flush in interface Flushable
      Specified by:
      flush in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • scalarValue

      public void scalarValue(Object value) throws IOException
      Specified by:
      scalarValue in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException
    • domSourceValue

      public void domSourceValue(DOMSource value) throws IOException
      Specified by:
      domSourceValue in interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
      Throws:
      IOException