X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2Ftree%2Fdata%2FStoreMetadataNode.java;h=77186a6509913742c97a9606f2e89f7691e941a8;hb=803d525860fbb1974b65ba5605ba5a9dfe1928a4;hp=8addb89bd1ae2180959ba458b2d0762f998d7f21;hpb=a31a4448ea6665317f4af41ae26d804829418c04;p=controller.git diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/StoreMetadataNode.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/StoreMetadataNode.java index 8addb89bd1..77186a6509 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/StoreMetadataNode.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/StoreMetadataNode.java @@ -13,7 +13,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreTreeNode; import org.opendaylight.yangtools.concepts.Identifiable; import org.opendaylight.yangtools.concepts.Immutable; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; @@ -24,15 +23,12 @@ import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.primitives.UnsignedLong; -// FIXME: this should not be public -public class StoreMetadataNode implements Immutable, Identifiable, StoreTreeNode { - +class StoreMetadataNode implements Immutable, Identifiable { + private final Map children; private final UnsignedLong nodeVersion; private final UnsignedLong subtreeVersion; private final NormalizedNode data; - private final Map children; - /** * * @param data @@ -40,11 +36,11 @@ public class StoreMetadataNode implements Immutable, Identifiable, * @param subtreeVersion * @param children Map of children, must not be modified externally */ - protected StoreMetadataNode(final NormalizedNode data, final UnsignedLong nodeVersion, + private StoreMetadataNode(final NormalizedNode data, final UnsignedLong nodeVersion, final UnsignedLong subtreeVersion, final Map children) { - this.nodeVersion = nodeVersion; - this.subtreeVersion = subtreeVersion; - this.data = data; + this.nodeVersion = Preconditions.checkNotNull(nodeVersion); + this.subtreeVersion = Preconditions.checkNotNull(subtreeVersion); + this.data = Preconditions.checkNotNull(data); this.children = Preconditions.checkNotNull(children); } @@ -53,11 +49,6 @@ public class StoreMetadataNode implements Immutable, Identifiable, Collections.emptyMap()); } - public StoreMetadataNode(final NormalizedNode data, final UnsignedLong nodeVersion, - final UnsignedLong subtreeVersion) { - this(data, nodeVersion, subtreeVersion, Collections.emptyMap()); - } - public static Builder builder() { return new Builder(); } @@ -83,8 +74,7 @@ public class StoreMetadataNode implements Immutable, Identifiable, return this.data; } - @Override - public Optional getChild(final PathArgument key) { + Optional getChild(final PathArgument key) { return Optional.fromNullable(children.get(key)); } @@ -137,7 +127,7 @@ public class StoreMetadataNode implements Immutable, Identifiable, children = new HashMap<>(); } - public Builder(StoreMetadataNode node) { + private Builder(StoreMetadataNode node) { children = new HashMap<>(node.children); }