Add yang.parser.rfc7950.stmt.meta
[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.parser.spi.meta.EffectiveStmtCtx;
17 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
18
19 public final class TypeStatementRFC6020Support extends AbstractTypeStatementSupport {
20     private static final TypeStatementRFC6020Support INSTANCE = new TypeStatementRFC6020Support();
21
22     private TypeStatementRFC6020Support() {
23         // Hidden
24     }
25
26     public static TypeStatementRFC6020Support getInstance() {
27         return INSTANCE;
28     }
29
30     @Override
31     Bit addRestrictedBit(final EffectiveStmtCtx stmt, final BitsTypeDefinition base, final BitEffectiveStatement bit) {
32         throw new SourceException("Restricted bits type is not allowed in YANG version 1", stmt);
33     }
34
35
36     @Override
37     EnumPair addRestrictedEnum(final EffectiveStmtCtx stmt, final EnumTypeDefinition base,
38             final EnumEffectiveStatement enumStmt) {
39         throw new SourceException("Restricted enumeration type is not allowed in YANG version 1", stmt);
40     }
41 }