7dd27025869a1434b68424bfc1336f969732b74d
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / action / ActionEffectiveStatementImpl.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. 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.rfc7950.stmt.action;
9
10 import com.google.common.collect.ImmutableList;
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
14 import org.opendaylight.yangtools.yang.model.api.SchemaNodeDefaults;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.ActionEffectiveStatement;
18 import org.opendaylight.yangtools.yang.model.api.stmt.ActionStatement;
19 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement.DefaultWithDataTree.WithSubstatements;
20 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.CopyableMixin;
21 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.OperationDefinitionMixin;
22
23 final class ActionEffectiveStatementImpl extends WithSubstatements<QName, ActionStatement, ActionEffectiveStatement>
24         implements ActionDefinition, ActionEffectiveStatement, OperationDefinitionMixin<ActionStatement>,
25                    CopyableMixin<QName, ActionStatement> {
26     private final @Nullable SchemaPath path;
27     private final int flags;
28
29     ActionEffectiveStatementImpl(final ActionStatement declared, final SchemaPath path, final int flags,
30             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
31         super(declared, substatements);
32         this.path = path;
33         this.flags = flags;
34     }
35
36     @Override
37     @Deprecated
38     public SchemaPath getPath() {
39         return SchemaNodeDefaults.throwUnsupportedIfNull(this, path);
40     }
41
42     @Override
43     public int flags() {
44         return flags;
45     }
46
47     @Override
48     public ActionEffectiveStatement asEffectiveStatement() {
49         return this;
50     }
51 }