Use pre-sized ImmutableLists for yang-data-api
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / datastore / node / utils / stream / NormalizedNodeOutputStreamWriter.java
index 5eaa7fc1b7cf1d9a82ae44a454f09cd8fa089853..40ca4f2e8693ce6c025909c643fd2041b7331c15 100644 (file)
@@ -13,6 +13,7 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Revision;
 
 /**
  * NormalizedNodeOutputStreamWriter will be used by distributed datastore to send normalized node in
@@ -25,7 +26,7 @@ import org.opendaylight.yangtools.yang.common.QName;
  * {@link #leafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, Object)} twice
  * and then, {@link #endNode()} to end container node.
  *
- * Based on the each node, the node type is also written to the stream, that helps in reconstructing the object,
+ * <p>Based on the each node, the node type is also written to the stream, that helps in reconstructing the object,
  * while reading.
  */
 final class NormalizedNodeOutputStreamWriter extends AbstractNormalizedNodeDataOutput {
@@ -36,7 +37,7 @@ final class NormalizedNodeOutputStreamWriter extends AbstractNormalizedNodeDataO
     }
 
     @Override
-    protected final short streamVersion() {
+    protected short streamVersion() {
         return TokenTypes.LITHIUM_VERSION;
     }
 
@@ -44,7 +45,7 @@ final class NormalizedNodeOutputStreamWriter extends AbstractNormalizedNodeDataO
     protected void writeQName(final QName qname) throws IOException {
         writeString(qname.getLocalName());
         writeString(qname.getNamespace().toString());
-        writeString(qname.getFormattedRevision());
+        writeString(qname.getRevision().map(Revision::toString).orElse(null));
     }
 
     @Override