X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-data-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fdata%2Fimpl%2Fschema%2Fbuilder%2Fimpl%2FImmutableUnkeyedListNodeBuilder.java;h=224d0aef847c60099126a11304400a744c630c62;hb=0736c9c93dff667dd2abaf5de92ca68ea64869d6;hp=eb2d3884bbc4dfda6a0e8f2a4a8e9eb39ae73a81;hpb=9e5540fb30986583d69e51f9290dbb651338f4b0;p=yangtools.git diff --git a/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/builder/impl/ImmutableUnkeyedListNodeBuilder.java b/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/builder/impl/ImmutableUnkeyedListNodeBuilder.java index eb2d3884bb..224d0aef84 100644 --- a/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/builder/impl/ImmutableUnkeyedListNodeBuilder.java +++ b/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/builder/impl/ImmutableUnkeyedListNodeBuilder.java @@ -13,8 +13,7 @@ import java.util.Collection; import java.util.Collections; import java.util.LinkedList; import java.util.List; -import org.opendaylight.yangtools.concepts.Immutable; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode; @@ -26,7 +25,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableN public class ImmutableUnkeyedListNodeBuilder implements CollectionNodeBuilder { private List value; - private YangInstanceIdentifier.NodeIdentifier nodeIdentifier; + private NodeIdentifier nodeIdentifier; private boolean dirty; protected ImmutableUnkeyedListNodeBuilder() { @@ -36,20 +35,22 @@ public class ImmutableUnkeyedListNodeBuilder implements CollectionNodeBuilder(); Iterables.addAll(value, node.getValue()); this.dirty = true; } - public static CollectionNodeBuilder create() { + public static @NonNull CollectionNodeBuilder create() { return new ImmutableUnkeyedListNodeBuilder(); } - public static CollectionNodeBuilder create(final int sizeHint) { + public static @NonNull CollectionNodeBuilder create(final int sizeHint) { return new ImmutableUnkeyedListNodeBuilder(); } - public static CollectionNodeBuilder create(final UnkeyedListNode node) { + public static @NonNull CollectionNodeBuilder create( + final UnkeyedListNode node) { if (!(node instanceof ImmutableUnkeyedListNode)) { throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass())); } @@ -73,16 +74,17 @@ public class ImmutableUnkeyedListNodeBuilder implements CollectionNodeBuilder withoutChild( - final YangInstanceIdentifier.PathArgument key) { + final PathArgument key) { checkDirty(); throw new UnsupportedOperationException("Children does not have identifiers."); } @Override - public CollectionNodeBuilder withValue(final Collection value) { + public CollectionNodeBuilder withValue( + final Collection withValue) { // TODO replace or putAll ? - for (final UnkeyedListEntryNode UnkeyedListEntryNode : value) { - withChild(UnkeyedListEntryNode); + for (final UnkeyedListEntryNode node : withValue) { + withChild(node); } return this; @@ -90,8 +92,8 @@ public class ImmutableUnkeyedListNodeBuilder implements CollectionNodeBuilder withNodeIdentifier( - final YangInstanceIdentifier.NodeIdentifier nodeIdentifier) { - this.nodeIdentifier = nodeIdentifier; + final NodeIdentifier withNodeIdentifier) { + this.nodeIdentifier = withNodeIdentifier; return this; } @@ -100,9 +102,8 @@ public class ImmutableUnkeyedListNodeBuilder implements CollectionNodeBuilder removeChild( - final PathArgument key) { + public NormalizedNodeContainerBuilder + removeChild(final PathArgument key) { return withoutChild(key); } - protected static final class EmptyImmutableUnkeyedListNode extends AbstractImmutableNormalizedNode> implements Immutable, UnkeyedListNode { + protected static final class EmptyImmutableUnkeyedListNode extends + AbstractImmutableNormalizedNode> + implements UnkeyedListNode { protected EmptyImmutableUnkeyedListNode(final NodeIdentifier nodeIdentifier) { super(nodeIdentifier); } @Override - public Collection getValue() { - return Collections.emptySet(); + public ImmutableList getValue() { + return ImmutableList.of(); } @Override @@ -148,12 +151,12 @@ public class ImmutableUnkeyedListNodeBuilder implements CollectionNodeBuilder> - implements Immutable, UnkeyedListNode { + AbstractImmutableNormalizedValueNode> + implements UnkeyedListNode { private final ImmutableList children; - ImmutableUnkeyedListNode(final YangInstanceIdentifier.NodeIdentifier nodeIdentifier, + ImmutableUnkeyedListNode(final NodeIdentifier nodeIdentifier, final ImmutableList children) { super(nodeIdentifier, children); this.children = children;