Remove EffectiveStatement namespaces
[yangtools.git] / model / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / stmt / ChoiceEffectiveStatement.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.model.api.stmt;
9
10 import java.util.Optional;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
14 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
15
16 /**
17  * Effective representation of a {@code choice} statement.
18  */
19 public interface ChoiceEffectiveStatement
20         extends SchemaTreeEffectiveStatement<ChoiceStatement>, DataTreeAwareEffectiveStatement<QName, ChoiceStatement> {
21     @Override
22     default StatementDefinition statementDefinition() {
23         return YangStmtMapping.CHOICE;
24     }
25
26     /**
27      * Namespace of available cases in a choice node. According to RFC7950 section 6.2.1:
28      * <pre>
29      *     All cases within a choice share the same case identifier
30      *     namespace.  This namespace is scoped to the parent choice node.
31      * </pre>
32      */
33     default @NonNull Optional<CaseEffectiveStatement> findCase(final @NonNull QName qname) {
34         return DefaultMethodHelpers.filterOptional(findSchemaTreeNode(qname), CaseEffectiveStatement.class);
35     }
36 }