Teach YANG parser to retain DeclarationReference
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / type / TypeStatementRFC6020Support.java
1 /*
2  * Copyright (c) 2017 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.rfc7950.stmt.type;
9
10 import org.opendaylight.yangtools.yang.model.api.stmt.BitEffectiveStatement;
11 import org.opendaylight.yangtools.yang.model.api.stmt.EnumEffectiveStatement;
12 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
13 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition.Bit;
14 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
15 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair;
16 import org.opendaylight.yangtools.yang.model.parser.api.YangParserConfiguration;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx;
18 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
19
20 public final class TypeStatementRFC6020Support extends AbstractTypeStatementSupport {
21     public TypeStatementRFC6020Support(final YangParserConfiguration config) {
22         super(config);
23     }
24
25     @Override
26     Bit addRestrictedBit(final EffectiveStmtCtx stmt, final BitsTypeDefinition base, final BitEffectiveStatement bit) {
27         throw new SourceException("Restricted bits type is not allowed in YANG version 1", stmt);
28     }
29
30
31     @Override
32     EnumPair addRestrictedEnum(final EffectiveStmtCtx stmt, final EnumTypeDefinition base,
33             final EnumEffectiveStatement enumStmt) {
34         throw new SourceException("Restricted enumeration type is not allowed in YANG version 1", stmt);
35     }
36 }