DeclaredStatements can contain default implementations
[yangtools.git] / yang / yang-parser-spi / src / main / java / org / opendaylight / yangtools / yang / parser / spi / meta / ImplicitParentAwareStatementSupport.java
1 /*
2  * Copyright (c) 2018 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.parser.spi.meta;
9
10 import com.google.common.annotations.Beta;
11 import java.util.Optional;
12 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
13
14 /**
15  * {@link StatementSupport} trait for statements which create intermediate parent node for some of its child nodes.
16  * An example of this is RFC6020/RFC7950 choice statement, which creates implicit case statements for child containers
17  * and others.
18  *
19  * @author Robert Varga
20  */
21 @Beta
22 // FIXME: 3.0.0: make this interface extend StatementSupport
23 public interface ImplicitParentAwareStatementSupport {
24     /**
25      * Returns implicit parent statement support for supplied statement definition, if it is defined. This allows
26      * implementations of this interface add implicit parent to the build context hierarchy before a substatement
27      * is created.
28      *
29      * @param stmtDef statement definition of substatement
30      * @return optional of implicit parent statement support
31      */
32     Optional<StatementSupport<?, ?, ?>> getImplicitParentFor(StatementDefinition stmtDef);
33 }