Bug 1411: MDSAL Binding2 Generator API Enumeration fix
[mdsal.git] / binding2 / mdsal-binding2-generator-api / src / main / java / org / opendaylight / mdsal / binding2 / model / api / type / builder / EnumBuilder.java
1 /*
2  * Copyright (c) 2016 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
9 package org.opendaylight.mdsal.binding2.model.api.type.builder;
10
11 import com.google.common.annotations.Beta;
12 import org.opendaylight.mdsal.binding2.model.api.Enumeration;
13 import org.opendaylight.mdsal.binding2.model.api.Type;
14 import org.opendaylight.yangtools.yang.model.api.Status;
15 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
16
17 /**
18  * Enum Builder is interface that contains methods to build and instantiate
19  * Enumeration definition.
20  *
21  * @see Enumeration
22  */
23 @Beta
24 public interface EnumBuilder extends Type {
25     /**
26      * The method creates new AnnotationTypeBuilder containing specified package
27      * name and annotation name. <br>
28      * Neither the package name or annotation name can contain <code>null</code>
29      * references. In case that any of parameters contains <code>null</code> the
30      * method SHOULD throw {@link IllegalArgumentException}
31      *
32      * @param packageName
33      *            Package Name of Annotation Type
34      * @param name
35      *            Name of Annotation Type
36      * @return <code>new</code> instance of Annotation Type Builder.
37      */
38     AnnotationTypeBuilder addAnnotation(final String packageName, final String name);
39
40     /**
41      *
42      * @param name
43      *          assigned name
44      * @param value
45      *          as optionally defined in YANG model
46      * @param description
47      *          as optionally defined in YANG model
48      * @param reference
49      *          as optionally defined in YANG model
50      * @param status
51      *          as optionally defined in YANG model
52      */
53     void addValue(final String name, final int value, final String description,
54                   final String reference, final Status status);
55
56     /**
57      *
58      * @param definingType
59      *              Type
60      * @return Enumeration
61      */
62     Enumeration toInstance(final Type definingType);
63
64     /**
65      * Updates this builder with data from <code>enumTypeDef</code>.
66      * Specifically this data represents list of value-name pairs.
67      *
68      * @param enumTypeDef
69      *            enum type definition as source of enum data for
70      *            <code>enumBuilder</code>
71      */
72     void updateEnumPairsFromEnumTypeDef(final EnumTypeDefinition enumTypeDef);
73
74     /**
75      * @param description
76      */
77     void setDescription(final String description);
78 }