BUG-6533: add immutable implementations of yang.model.api
[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 javax.annotation.Nonnull;
12 import org.opendaylight.yangtools.yang.model.api.DocumentedNode;
13 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
14
15 /**
16  * Makes is possible to access to the individual enumeration values of this
17  * type.
18  */
19 public interface EnumTypeDefinition extends TypeDefinition<EnumTypeDefinition> {
20     /**
21      * Returns all enumeration values.
22      *
23      * @return list of <code>EnumPair</code> type instastances which contain the
24      *         data about all individual enumeration pairs of
25      *         <code>enumeration</code> YANG built-in type
26      */
27     @Nonnull List<EnumPair> getValues();
28
29     /**
30      * Contains the methods for accessing the data about the concrete
31      * enumeration item which represents <code>enum</code> YANG type.
32      */
33     interface EnumPair extends DocumentedNode.WithStatus {
34         /**
35          * The name to specify each assigned name of an enumeration type.
36          *
37          * @return name of each assigned name of an enumeration type.
38          */
39         String getName();
40
41         /**
42          * The "value" statement, which is optional, is used to associate an
43          * integer value with the assigned name for the enum. This integer value
44          * MUST be unique within the enumeration type.
45          *
46          * @return integer value assigned to enumeration
47          */
48         int getValue();
49     }
50 }