Eliminate superfluous onFullDefinitionDeclared overrides
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / LeafrefSpecificationImpl.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 javax.annotation.Nonnull;
11 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
12 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
13 import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement.LeafrefSpecification;
15 import org.opendaylight.yangtools.yang.parser.spi.SubstatementValidator;
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 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.LeafrefSpecificationEffectiveStatementImpl;
20
21 public class LeafrefSpecificationImpl extends AbstractDeclaredStatement<String>
22         implements LeafrefSpecification {
23     private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
24             .TYPE)
25             .addMandatory(YangStmtMapping.PATH)
26             .addOptional(YangStmtMapping.REQUIRE_INSTANCE)
27             .build();
28
29     protected LeafrefSpecificationImpl(
30             final StmtContext<String, LeafrefSpecification, ?> context) {
31         super(context);
32     }
33
34     public static class Definition
35             extends
36             AbstractStatementSupport<String, LeafrefSpecification, EffectiveStatement<String, LeafrefSpecification>> {
37
38         public Definition() {
39             super(YangStmtMapping.TYPE);
40         }
41
42         @Override
43         public String parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
44             return value;
45         }
46
47         @Override
48         public LeafrefSpecification createDeclared(final StmtContext<String, LeafrefSpecification, ?> ctx) {
49             return new LeafrefSpecificationImpl(ctx);
50         }
51
52         @Override
53         public EffectiveStatement<String, LeafrefSpecification> createEffective(
54                 final StmtContext<String, LeafrefSpecification, EffectiveStatement<String, LeafrefSpecification>> ctx) {
55             return new LeafrefSpecificationEffectiveStatementImpl(ctx);
56         }
57
58         @Override
59         protected SubstatementValidator getSubstatementValidator() {
60             return SUBSTATEMENT_VALIDATOR;
61         }
62     }
63
64     @Nonnull
65     @Override
66     public String getName() {
67         return argument();
68     }
69
70     @Nonnull
71     @Override
72     public PathStatement getPath() {
73         return firstDeclared(PathStatement.class);
74     }
75
76 }