/** * Returns a {@code data node} identified by a series of QNames. This is equivalent to incrementally calling * {@link #findDataTreeChild(QName)}. * * @param path Series of QNames towards identifying the requested data node * @return Direct or indirect child of this DataNodeContainer which is a {@code data node}, empty otherwise * @throws IllegalArgumentException if {@code path} is determined to go beyond a not-container-nor-list node. * @throws NoSuchElementException if {@code path} is empty * @throws NullPointerException if {@code path} is null or contains a null */ @Beta default Optional<DataSchemaNode> findDataTreeChild(final QName... path) { return findDataTreeChild(Arrays.asList(path)); }
/** * Returns a {@code data node} identified by a series of QNames. This is equivalent to incrementally calling * {@link #findDataTreeChild(QName)}. * * @param path Series of QNames towards identifying the requested data node * @return Direct or indirect child of this DataNodeContainer which is a {@code data node}, empty otherwise * @throws IllegalArgumentException if {@code path} is determined to go beyond a not-container-nor-list node. * @throws NoSuchElementException if {@code path} is empty * @throws NullPointerException if {@code path} is null or contains a null */ @Beta default Optional<DataSchemaNode> findDataTreeChild(final QName... path) { return findDataTreeChild(Arrays.asList(path)); }
/** * Returns a {@code data node} identified by a series of QNames. This is equivalent to incrementally calling * {@link #findDataTreeChild(QName)}. * * @param path Series of QNames towards identifying the requested data node * @return Direct or indirect child of this DataNodeContainer which is a {@code data node}, empty otherwise * @throws IllegalArgumentException if {@code path} is determined to go beyond a not-container-nor-list node. * @throws NoSuchElementException if {@code path} is empty * @throws NullPointerException if {@code path} is null or contains a null */ @Beta default Optional<DataSchemaNode> findDataTreeChild(final Iterable<QName> path) { final Iterator<QName> it = path.iterator(); DataNodeContainer parent = this; do { final Optional<DataSchemaNode> optChild = parent.findDataTreeChild(requireNonNull(it.next())); if (!optChild.isPresent() || !it.hasNext()) { return optChild; } final DataSchemaNode child = optChild.get(); checkArgument(child instanceof DataNodeContainer, "Path %s extends beyond terminal child %s", path, child); parent = (DataNodeContainer) child; } while (true); } }
/** * Returns a {@code data node} identified by a series of QNames. This is equivalent to incrementally calling * {@link #findDataTreeChild(QName)}. * * @param path Series of QNames towards identifying the requested data node * @return Direct or indirect child of this DataNodeContainer which is a {@code data node}, empty otherwise * @throws IllegalArgumentException if {@code path} is determined to go beyond a not-container-nor-list node. * @throws NoSuchElementException if {@code path} is empty * @throws NullPointerException if {@code path} is null or contains a null */ @Beta default Optional<DataSchemaNode> findDataTreeChild(final Iterable<QName> path) { final Iterator<QName> it = path.iterator(); DataNodeContainer parent = this; do { final Optional<DataSchemaNode> optChild = parent.findDataTreeChild(requireNonNull(it.next())); if (!optChild.isPresent() || !it.hasNext()) { return optChild; } final DataSchemaNode child = optChild.get(); checkArgument(child instanceof DataNodeContainer, "Path %s extends beyond terminal child %s", path, child); parent = (DataNodeContainer) child; } while (true); } }