Bug 2366 - Effective statements impl for new yang parser.
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / IfFeatureStatementImpl.java
1 /**
2  * Copyright (c) 2015 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.stmt.rfc6020;
9
10 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.IfFeatureEffectiveStatementImpl;
11
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
14 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
19
20 public class IfFeatureStatementImpl extends AbstractDeclaredStatement<QName>
21         implements IfFeatureStatement {
22
23     protected IfFeatureStatementImpl(
24             StmtContext<QName, IfFeatureStatement, ?> context) {
25         super(context);
26     }
27
28     public static class Definition
29             extends
30             AbstractStatementSupport<QName, IfFeatureStatement, EffectiveStatement<QName, IfFeatureStatement>> {
31
32         public Definition() {
33             super(Rfc6020Mapping.IF_FEATURE);
34         }
35
36         @Override
37         public QName parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) {
38             return Utils.qNameFromArgument(ctx, value);
39         }
40
41         @Override
42         public IfFeatureStatement createDeclared(
43                 StmtContext<QName, IfFeatureStatement, ?> ctx) {
44             return new IfFeatureStatementImpl(ctx);
45         }
46
47         @Override
48         public EffectiveStatement<QName, IfFeatureStatement> createEffective(
49                 StmtContext<QName, IfFeatureStatement, EffectiveStatement<QName, IfFeatureStatement>> ctx) {
50             return new IfFeatureEffectiveStatementImpl(ctx);
51         }
52
53     }
54
55     @Override
56     public QName getName() {
57         return argument();
58     }
59
60 }