Cache NodeContextSuppliers in CodecDataObject
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / mdsal / binding / dom / codec / impl / DataContainerCodecContext.java
index d999cbc14ff4d85c35c283927af5160c510dd038..738b5011deb8eac6e69ee407c32cf7d56b809ec3 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.mdsal.binding.dom.codec.impl;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.ImmutableCollection;
 import com.google.common.collect.ImmutableSet;
 import java.io.IOException;
@@ -32,12 +34,12 @@ import org.opendaylight.yangtools.yang.model.api.DocumentedNode.WithStatus;
 
 abstract class DataContainerCodecContext<D extends DataObject, T extends WithStatus> extends NodeCodecContext
         implements BindingDataObjectCodecTreeNode<D>  {
+    private final @NonNull DataContainerCodecPrototype<T> prototype;
 
-    private final DataContainerCodecPrototype<T> prototype;
     private volatile DataObjectSerializer eventStreamSerializer;
 
     protected DataContainerCodecContext(final DataContainerCodecPrototype<T> prototype) {
-        this.prototype = prototype;
+        this.prototype = requireNonNull(prototype);
     }
 
     @Override