Split out NormalizedContainer
[yangtools.git] / data / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / schema / DistinctNodeContainer.java
index ae82f698a37e4aa31855ccce3a60075308e15c01..cafeb01d83bb4067ab744139db1ce7c92e5553d8 100644 (file)
@@ -7,13 +7,6 @@
  */
 package org.opendaylight.yangtools.yang.data.api.schema;
 
-import static com.google.common.base.Verify.verifyNotNull;
-
-import com.google.common.base.VerifyException;
-import java.util.Collection;
-import java.util.Optional;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
 /**
@@ -31,48 +24,6 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
  * @param <V> Child Node type
  */
 public non-sealed interface DistinctNodeContainer<K extends PathArgument, V extends NormalizedNode>
-        extends NormalizedNodeContainer<V> {
-    /**
-     * {@inheritDoc}
-     *
-     * <p>
-     * All nodes returned in this iterable, MUST also be accessible via {@link #childByArg(PathArgument)} using their
-     * associated identifier.
-     *
-     * @return Iteration of all child nodes
-     */
-    @Override
-    Collection<@NonNull V> body();
-
-    /**
-     * Returns a child node identified by provided key.
-     *
-     * @param key Path argument identifying child node
-     * @return Matching child node, or null if no matching child exists
-     * @throws NullPointerException if {@code key} is {@code null}
-     */
-    @Nullable V childByArg(K key);
-
-    /**
-     * Attempts to find a child node identified by provided key.
-     *
-     * @param key Path argument identifying child node
-     * @return Optional with child node if child exists. {@link Optional#empty()} if child does not exist
-     * @throws NullPointerException if {@code key} is {@code null}
-     */
-    default Optional<V> findChildByArg(final K key) {
-        return Optional.ofNullable(childByArg(key));
-    }
-
-    /**
-     * Returns a child node identified by provided key, asserting its presence.
-     *
-     * @param key Path argument identifying child node
-     * @return Matching child node
-     * @throws NullPointerException if {@code key} is {@code null}
-     * @throws VerifyException if the child does not exist
-     */
-    default @NonNull V getChildByArg(final K key) {
-        return verifyNotNull(childByArg(key), "No child matching %s", key);
-    }
+        extends DistinctContainer<K, V>, NormalizedNodeContainer<V> {
+    // Composition of DistinctContainer and NormalizedNodeContainer
 }