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 f68e86f1ae9decf1dffa36b507ef6d637cb316b7..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,22 +26,18 @@ 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.
  */
-public class NormalizedNodeOutputStreamWriter extends AbstractNormalizedNodeDataOutput {
+final class NormalizedNodeOutputStreamWriter extends AbstractNormalizedNodeDataOutput {
     private final Map<String, Integer> stringCodeMap = new HashMap<>();
 
-    /**
-     * @deprecated Use {@link NormalizedNodeInputOutput#newDataOutput(DataOutput)} instead.
-     */
-    @Deprecated
-    public NormalizedNodeOutputStreamWriter(final DataOutput output) {
+    NormalizedNodeOutputStreamWriter(final DataOutput output) {
         super(output);
     }
 
     @Override
-    protected final short streamVersion() {
+    protected short streamVersion() {
         return TokenTypes.LITHIUM_VERSION;
     }
 
@@ -48,7 +45,7 @@ public class NormalizedNodeOutputStreamWriter extends AbstractNormalizedNodeData
     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