Add DataNodeContainer.dataChildByName()
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / DataNodeContainer.java
index 9b695fe02e31014f5dc7d2a06ce0901d488424e5..eb1a8e7719700298b24d96e1bb0e38ba879cf9e6 100644 (file)
@@ -61,14 +61,31 @@ public interface DataNodeContainer {
      *
      * @param name QName of child
      * @return child node of this DataNodeContainer if child with given name is present, null otherwise
-     * @deprecated Use {@link #findDataChildByName(QName)} instead.
      * @throws NullPointerException if {@code name} is null
      */
-    @Deprecated
-    default @Nullable DataSchemaNode getDataChildByName(final QName name) {
+    default @Nullable DataSchemaNode dataChildByName(final QName name) {
         return findDataChildByName(name).orElse(null);
     }
 
+    /**
+     * Returns the child node corresponding to the specified name.
+     *
+     * <p>
+     * Note that the nodes searched are <strong>NOT</strong> {@code data nodes}, but rather {@link DataSchemaNode}s,
+     * hence {@link ChoiceSchemaNode} and {@link CaseSchemaNode} are returned instead of their matching children. This
+     * is consistent with {@code schema tree}.
+     *
+     * @param name QName of child
+     * @return child node of this DataNodeContainer if child with given name is present, null otherwise
+     * @deprecated Use {@link #dataChildByName(QName)} or {@link #findDataChildByName(QName)} instead. This method will
+     *             be repurposed to assert existence in the next major release.
+     * @throws NullPointerException if {@code name} is null
+     */
+    @Deprecated(forRemoval = true)
+    default @Nullable DataSchemaNode getDataChildByName(final QName name) {
+        return dataChildByName(name);
+    }
+
     /**
      * Returns the child node corresponding to the specified name.
      *