2 * Copyright (c) 2017 Pantheon Technologies 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.rfc6536.model.api;
10 import com.google.common.annotations.Beta;
11 import java.util.Optional;
12 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
13 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
16 * Represents the effect of 'default-deny-write' extension, as defined in
17 * <a href="https://tools.ietf.org/html/rfc6536">RFC6536</a>, being attached to a SchemaNode.
20 public interface DefaultDenyWriteSchemaNode extends UnknownSchemaNode {
22 * Attempt to find a {@link DefaultDenyWriteSchemaNode} in a parent {@link DataSchemaNode}.
24 * @param parent Parent to search
25 * @return {@link DefaultDenyWriteSchemaNode} child, if present.
27 static Optional<DefaultDenyWriteSchemaNode> findIn(final DataSchemaNode parent) {
28 return parent.getUnknownSchemaNodes().stream().filter(DefaultDenyWriteSchemaNode.class::isInstance).findAny()
29 .map(DefaultDenyWriteSchemaNode.class::cast);