BUG-865: make EnumPair getQName/getSchemaPath unimplemented
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / type / EnumTypeDefinition.java
1 /*
2  * Copyright (c) 2013 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.model.api.type;
9
10 import java.util.List;
11 import org.opendaylight.yangtools.yang.common.QName;
12 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
13 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
14 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
15
16 /**
17  *
18  * Makes is possible to access to the individual enumeration values of this
19  * type.
20  *
21  */
22 public interface EnumTypeDefinition extends TypeDefinition<EnumTypeDefinition> {
23
24     /**
25      * Returns all enumeration values.
26      *
27      * @return list of <code>EnumPair</code> type instastances which contain the
28      *         data about all individual enumeration pairs of
29      *         <code>enumeration</code> YANG built-in type
30      */
31     List<EnumPair> getValues();
32
33     /**
34      *
35      * Contains the methods for accessing the data about the concrete
36      * enumeration item which represents <code>enum</code> YANG type.
37      */
38     interface EnumPair extends SchemaNode {
39
40         /**
41          *
42          * @deprecated Enum pair SHOULD NOT have schema path, since it's argument is only string and
43          *             not QName.
44          *
45          */
46         @Deprecated
47         @Override
48         default SchemaPath getPath() {
49             throw new UnsupportedOperationException("Enum pairs do not have SchemaPath");
50         }
51
52         /**
53          *
54          * @deprecated Enum pair SHOULD NOT have QName, since it's argument is only string (allows
55          *             characters not allowed in QName) and not QName. Use {@link #getName()}
56          *             instead.
57          *
58          */
59         @Deprecated
60         @Override
61         default QName getQName() {
62             throw new UnsupportedOperationException("Enum pairs do not have QName, only name");
63         }
64
65         /**
66          * The name to specify each assigned name of an enumeration type.
67          *
68          * @return name of each assigned name of an enumeration type.
69          */
70         String getName();
71
72         /**
73          * The "value" statement, which is optional, is used to associate an
74          * integer value with the assigned name for the enum. This integer value
75          * MUST be in the range -2147483648 to 2147483647, and it MUST be unique
76          * within the enumeration type.
77          *
78          * @return integer value assigned to enumeration
79          */
80         Integer getValue();
81     }
82 }