Revert Merge "Bug 2366: new parser - Types & TypeDefs"
[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 org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
11
12 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
13 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
14 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
16 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
17 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
18 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
19
20 public class LeafrefSpecificationImpl extends AbstractDeclaredStatement<String>
21         implements TypeStatement.LeafrefSpecification {
22
23     protected LeafrefSpecificationImpl(
24             StmtContext<String, TypeStatement.LeafrefSpecification, ?> context) {
25         super(context);
26     }
27
28     public static class Definition
29             extends
30             AbstractStatementSupport<String, TypeStatement.LeafrefSpecification, EffectiveStatement<String, TypeStatement.LeafrefSpecification>> {
31
32         public Definition() {
33             super(Rfc6020Mapping.PATH);
34         }
35
36         @Override
37         public String parseArgumentValue(StmtContext<?, ?, ?> ctx, String value)
38                 throws SourceException {
39             return value;
40         }
41
42         @Override
43         public TypeStatement.LeafrefSpecification createDeclared(
44                 StmtContext<String, TypeStatement.LeafrefSpecification, ?> ctx) {
45             return new LeafrefSpecificationImpl(ctx);
46         }
47
48         @Override
49         public EffectiveStatement<String, TypeStatement.LeafrefSpecification> createEffective(
50                 StmtContext<String, TypeStatement.LeafrefSpecification, EffectiveStatement<String, TypeStatement.LeafrefSpecification>> ctx) {
51             throw new UnsupportedOperationException();
52         }
53     }
54
55     @Override
56     public String getName() {
57         return argument();
58     }
59
60     @Override
61     public PathStatement getPath() {
62         return firstDeclared(PathStatement.class);
63     }
64
65 }