--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.api.schema.opaque;
+
+import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.yang.data.api.schema.AnydataNode;
+
+/**
+ * Opaque structured data. This interface defines an object model usable with {@link AnydataNode} when no underlying
+ * schema is available.
+ *
+ * <p>
+ * The data model supports two semantic layouts, based on the source of the data. This is needed due to at least two
+ * list encapsulation formats being defined -- JSON encoding (RFC7951) encapsulates list entries in an enclosing list
+ * node, while XML encoding (RFC7950) has list entries mixed with other siblings. XML encoding cannot accurately
+ * reconstruct this encapsulation because it is impossible to discern a single-node list from a container. The absence
+ * of this ambiguity is indicated through {@link #hasAccurateLists()}.
+ *
+ * <p>
+ * All implementations of this interface are required to be deeply-immutable.
+ */
+@Beta
+@NonNullByDefault
+public interface OpaqueData extends Immutable {
+ /**
+ * Get the root node of this data.
+ *
+ * @return Root node
+ */
+ OpaqueDataNode getRoot();
+
+ /**
+ * Indicate whether the data tree held in this object has accurate list encapsulation or not.
+ *
+ * @return {@code true} if this tree is guaranteed to use accurate encapsulation of lists, {@code false} otherwise.
+ */
+ boolean hasAccurateLists();
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.api.schema.opaque;
+
+import com.google.common.annotations.Beta;
+import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
+
+/**
+ * A container-like opaque data node. It can contain other OpaqueDataNodes as its children.
+ *
+ * @author Robert Varga
+ */
+@Beta
+public interface OpaqueDataContainer extends OpaqueDataNode {
+
+ @NonNull List<? extends OpaqueDataNode> getChildren();
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.api.schema.opaque;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * A list containment node in the OpaqueData. It can contain other OpaqueDataNodes.
+ */
+@Beta
+public interface OpaqueDataList extends OpaqueDataContainer {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.api.schema.opaque;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.concepts.Identifiable;
+import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+
+/**
+ * Common interface for opaque containers and lists. All implementations of this interface are required to be
+ * deeply-immutable.
+ */
+@Beta
+public interface OpaqueDataNode extends Identifiable<NodeIdentifier>, Immutable {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.api.schema.opaque;
+
+import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNull;
+
+/**
+ * A value-bearing OpaqueDataNode.
+ */
+@Beta
+public interface OpaqueDataValue extends OpaqueDataNode {
+
+ @NonNull Object getValue();
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+/**
+ * Opaque data interfaces, supporting unknown contents of an {@code anydata} node.
+ */
+package org.opendaylight.yangtools.yang.data.api.schema.opaque;
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.base.MoreObjects.ToStringHelper;
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataNode;
+
+@NonNullByDefault
+abstract class AbstractOpaqueDataContainer extends AbstractOpaqueDataNode {
+ private final ImmutableList<OpaqueDataNode> children;
+
+ AbstractOpaqueDataContainer(final NodeIdentifier identifier, final ImmutableList<OpaqueDataNode> children) {
+ super(identifier);
+ this.children = requireNonNull(children);
+ }
+
+ final ImmutableList<OpaqueDataNode> children() {
+ return children;
+ }
+
+ @Override
+ final ToStringHelper addToStringAttributes(final ToStringHelper helper) {
+ return super.addToStringAttributes(helper).add("children", children);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataContainer;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataNode;
+
+@Beta
+public abstract class AbstractOpaqueDataContainerBuilder<T extends OpaqueDataContainer>
+ extends AbstractOpaqueDataNodeBuilder<T> {
+ private final List<@NonNull OpaqueDataNode> children;
+
+ AbstractOpaqueDataContainerBuilder() {
+ this.children = new ArrayList<>();
+ }
+
+ AbstractOpaqueDataContainerBuilder(final int size) {
+ this.children = new ArrayList<>(size);
+ }
+
+ public AbstractOpaqueDataContainerBuilder<T> withChild(final OpaqueDataNode child) {
+ children.add(requireNonNull(child));
+ return this;
+ }
+
+ public OpaqueDataValueBuilder withValue(final Object value) {
+ checkState(children.isEmpty(), "Unexpected children %s", children);
+ return new OpaqueDataValueBuilder().withIdentifier(identifier()).withValue(value);
+ }
+
+ @Override
+ final T build(final NodeIdentifier identifier) {
+ return build(identifier, ImmutableList.copyOf(children));
+ }
+
+ abstract @NonNull T build(@NonNull NodeIdentifier identifier, @NonNull ImmutableList<OpaqueDataNode> children);
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.MoreObjects.ToStringHelper;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataNode;
+
+@NonNullByDefault
+abstract class AbstractOpaqueDataNode implements OpaqueDataNode {
+ private final NodeIdentifier identifier;
+
+ AbstractOpaqueDataNode(final NodeIdentifier identifier) {
+ this.identifier = requireNonNull(identifier);
+ }
+
+ @Override
+ public final NodeIdentifier getIdentifier() {
+ return identifier;
+ }
+
+ @Override
+ public abstract int hashCode();
+
+ @Override
+ public abstract boolean equals(@Nullable Object obj);
+
+ @Override
+ public final String toString() {
+ return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
+ }
+
+ ToStringHelper addToStringAttributes(final ToStringHelper helper) {
+ return helper.add("identifier", identifier);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataNode;
+
+@Beta
+public abstract class AbstractOpaqueDataNodeBuilder<T extends OpaqueDataNode> implements Builder<T> {
+ private NodeIdentifier identifier;
+
+ AbstractOpaqueDataNodeBuilder() {
+ // Hidden on purpose
+ }
+
+ final NodeIdentifier identifier() {
+ return identifier;
+ }
+
+ public AbstractOpaqueDataNodeBuilder<T> withIdentifier(final NodeIdentifier newIdentifier) {
+ checkState(identifier == null, "Identifier already set to %s", identifier);
+ identifier = requireNonNull(newIdentifier);
+ return this;
+ }
+
+ public abstract OpaqueDataValueBuilder withValue(Object value);
+
+ @Override
+ public final T build() {
+ checkState(identifier != null, "Identifier not set");
+ return build(identifier);
+ }
+
+ abstract @NonNull T build(@NonNull NodeIdentifier identifier);
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.base.MoreObjects;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueData;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataNode;
+
+@NonNullByDefault
+final class ImmutableOpaqueData implements OpaqueData {
+ private final OpaqueDataNode root;
+ private final boolean accurateLists;
+
+ ImmutableOpaqueData(final OpaqueDataNode root, final boolean accurateLists) {
+ this.root = requireNonNull(root);
+ this.accurateLists = accurateLists;
+ }
+
+ @Override
+ public OpaqueDataNode getRoot() {
+ return root;
+ }
+
+ @Override
+ public boolean hasAccurateLists() {
+ return accurateLists;
+ }
+
+ @Override
+ public int hashCode() {
+ return root.hashCode();
+ }
+
+ @Override
+ public boolean equals(final @Nullable Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof OpaqueData)) {
+ return false;
+ }
+ final OpaqueData other = (OpaqueData) obj;
+ return accurateLists == other.hasAccurateLists() && root.equals(other.getRoot());
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this).add("root", root).add("accurateLists", accurateLists).toString();
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataContainer;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataNode;
+
+@NonNullByDefault
+final class ImmutableOpaqueDataContainer extends AbstractOpaqueDataContainer implements OpaqueDataContainer {
+ ImmutableOpaqueDataContainer(final NodeIdentifier identifier, final ImmutableList<OpaqueDataNode> children) {
+ super(identifier, children);
+ }
+
+ @Override
+ public ImmutableList<OpaqueDataNode> getChildren() {
+ return children();
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 * getIdentifier().hashCode() + children().hashCode();
+ }
+
+ @Override
+ public boolean equals(final @Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof OpaqueDataContainer)) {
+ return false;
+ }
+ final OpaqueDataContainer other = (OpaqueDataContainer) obj;
+ return getIdentifier().equals(other.getIdentifier()) && children().equals(other.getChildren());
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataList;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataNode;
+
+@NonNullByDefault
+final class ImmutableOpaqueDataList extends AbstractOpaqueDataContainer implements OpaqueDataList {
+ ImmutableOpaqueDataList(final NodeIdentifier identifier, final ImmutableList<OpaqueDataNode> children) {
+ super(identifier, children);
+ }
+
+ @Override
+ public ImmutableList<OpaqueDataNode> getChildren() {
+ return children();
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 * getIdentifier().hashCode() + children().hashCode();
+ }
+
+ @Override
+ public boolean equals(final @Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof OpaqueDataList)) {
+ return false;
+ }
+ final OpaqueDataList other = (OpaqueDataList) obj;
+ return getIdentifier().equals(other.getIdentifier()) && children().equals(other.getChildren());
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.base.MoreObjects.ToStringHelper;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataValue;
+
+@NonNullByDefault
+final class ImmutableOpaqueDataValue extends AbstractOpaqueDataNode implements OpaqueDataValue {
+ private final Object value;
+
+ ImmutableOpaqueDataValue(final NodeIdentifier identifier, final Object value) {
+ super(identifier);
+ this.value = requireNonNull(value);
+ }
+
+ @Override
+ public Object getValue() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 + getIdentifier().hashCode() + value.hashCode();
+ }
+
+ @Override
+ public boolean equals(final @Nullable Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof OpaqueDataValue)) {
+ return false;
+ }
+ final OpaqueDataValue other = (OpaqueDataValue) obj;
+ return getIdentifier().equals(other.getIdentifier()) && value.equals(other.getValue());
+ }
+
+ @Override
+ ToStringHelper addToStringAttributes(final ToStringHelper helper) {
+ return super.addToStringAttributes(helper).add("value", value);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueData;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataNode;
+
+@Beta
+public final class OpaqueDataBuilder implements Builder<OpaqueData> {
+ private OpaqueDataNode root;
+ private boolean accurateLists = false;
+
+ public OpaqueDataBuilder withAccurateLists(final boolean newAccurateLists) {
+ this.accurateLists = newAccurateLists;
+ return this;
+ }
+
+ public OpaqueDataBuilder withRoot(final OpaqueDataNode newRoot) {
+ checkState(root == null, "Root node already set to %s", root);
+ root = requireNonNull(newRoot);
+ return this;
+ }
+
+ @Override
+ public OpaqueData build() {
+ checkState(root != null, "Root node not set");
+ return new ImmutableOpaqueData(root, accurateLists);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataContainer;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataNode;
+
+@Beta
+public final class OpaqueDataContainerBuilder extends AbstractOpaqueDataContainerBuilder<OpaqueDataContainer> {
+ public OpaqueDataContainerBuilder() {
+
+ }
+
+ public OpaqueDataContainerBuilder(final int size) {
+ super(size);
+ }
+
+ @Override
+ public OpaqueDataContainerBuilder withChild(final OpaqueDataNode child) {
+ super.withChild(child);
+ return this;
+ }
+
+ @Override
+ OpaqueDataContainer build(final NodeIdentifier identifier, final ImmutableList<@NonNull OpaqueDataNode> children) {
+ return new ImmutableOpaqueDataContainer(identifier, children);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import static com.google.common.base.Preconditions.checkState;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataList;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataNode;
+
+@Beta
+public final class OpaqueDataListBuilder extends AbstractOpaqueDataContainerBuilder<OpaqueDataList> {
+ public OpaqueDataListBuilder() {
+
+ }
+
+ public OpaqueDataListBuilder(final int size) {
+ super(size);
+ }
+
+ @Override
+ public OpaqueDataListBuilder withChild(final OpaqueDataNode child) {
+ super.withChild(child);
+ return this;
+ }
+
+ @Override
+ OpaqueDataList build(final NodeIdentifier identifier, final ImmutableList<OpaqueDataNode> children) {
+ for (OpaqueDataNode child : children) {
+ checkState(identifier.equals(child.getIdentifier()), "Child %s does not match list identifier %s", child,
+ identifier);
+ }
+ return new ImmutableOpaqueDataList(identifier, children);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
+
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueDataValue;
+
+@Beta
+public final class OpaqueDataValueBuilder extends AbstractOpaqueDataNodeBuilder<OpaqueDataValue> {
+ private Object value;
+
+ @Override
+ public OpaqueDataValueBuilder withIdentifier(final NodeIdentifier identifier) {
+ super.withIdentifier(identifier);
+ return this;
+ }
+
+ @Override
+ public OpaqueDataValueBuilder withValue(final Object newValue) {
+ checkState(value == null, "Value has already been set to %s", value);
+ value = requireNonNull(newValue);
+ return this;
+ }
+
+ @Override
+ public OpaqueDataValue build(final NodeIdentifier identifier) {
+ checkState(value != null, "Value has not been set");
+ return new ImmutableOpaqueDataValue(identifier, value);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+/**
+ * Immutable implementation of {@link org.opendaylight.yangtools.yang.data.api.schema.opaque.OpaqueData} and related
+ * interfaces.
+ */
+package org.opendaylight.yangtools.yang.data.util.schema.opaque;
\ No newline at end of file