2 * Copyright (c) 2019 PANTHEON.tech s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.rfc8528.model.api;
10 import com.google.common.annotations.Beta;
11 import java.util.stream.Stream;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
14 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
18 * Represents the effect of 'mount-point' extension, as defined in
19 * <a href="https://tools.ietf.org/html/rfc8528">RFC8528</a>, being attached to a SchemaNode.
22 public interface MountPointSchemaNode extends UnknownSchemaNode {
24 * Find all mount points defined in a {@link ContainerSchemaNode}.
26 * @param schema ContainerSchemaNode to search
27 * @return {@link MountPointSchemaNode}s defined the ContainerSchemaNode.
28 * @throws NullPointerException if context is null
30 static @NonNull Stream<MountPointSchemaNode> streamAll(final ContainerSchemaNode schema) {
31 return schema.getUnknownSchemaNodes().stream()
32 .filter(MountPointSchemaNode.class::isInstance)
33 .map(MountPointSchemaNode.class::cast);
37 * Find all mount points defined in a {@link ListSchemaNode}.
39 * @param schema ListSchemaNode to search
40 * @return {@link MountPointSchemaNode}s defined the ListSchemaNode.
41 * @throws NullPointerException if context is null
43 static @NonNull Stream<MountPointSchemaNode> streamAll(final ListSchemaNode schema) {
44 return schema.getUnknownSchemaNodes().stream()
45 .filter(MountPointSchemaNode.class::isInstance)
46 .map(MountPointSchemaNode.class::cast);