Extended binding-model-api to support of Enclosed Generated Types and TOs.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / binding-model-api / src / main / java / org / opendaylight / controller / sal / binding / model / api / type / builder / GeneratedTypeBuilder.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.controller.sal.binding.model.api.type.builder;
9
10 import org.opendaylight.controller.sal.binding.model.api.Constant;
11 import org.opendaylight.controller.sal.binding.model.api.GeneratedType;
12 import org.opendaylight.controller.sal.binding.model.api.Type;
13
14 /**
15  * Generated Type Builder interface is helper interface for building and
16  * defining the GeneratedType.
17  *
18  * @see GeneratedType
19  */
20 public interface GeneratedTypeBuilder extends Type {
21
22     /**
23      * Adds new Enclosing Type into definition of Generated Type and returns
24      * <code>new</code> Instance of Generated Type Builder.
25      * <br>
26      * There is no need of specifying of Package Name because enclosing Type
27      * is already defined inside Generated Type with specific package name.
28      * <br>
29      * The name of enclosing Type cannot be same as Name of parent type and
30      * if there is already defined enclosing type with the same name,
31      * the new enclosing type will simply overwrite the older definition.
32      * <br>
33      * If the name of enclosing type is <code>null</code> the method SHOULD
34      * throw {@link IllegalArgumentException}
35      *
36      * @param name Name of Enclosing Type
37      * @return <code>new</code> Instance of Generated Type Builder.
38      */
39     public GeneratedTypeBuilder addEnclosingType(final String name);
40
41     /**
42      * Adds new Enclosing Transfer Object into definition of Generated Type
43      * and returns <code>new</code> Instance of Generated TO Builder.
44      * <br>
45      * There is no need of specifying of Package Name because enclosing Type
46      * is already defined inside Generated Type with specific package name.
47      * <br>
48      * The name of enclosing Type cannot be same as Name of parent type and
49      * if there is already defined enclosing type with the same name,
50      * the new enclosing type will simply overwrite the older definition.
51      * <br>
52      * If the name of enclosing type is <code>null</code> the method SHOULD
53      * throw {@link IllegalArgumentException}
54      *
55      * @param name Name of Enclosing Type
56      * @return <code>new</code> Instance of Generated Type Builder.
57      */
58     public GeneratedTOBuilder addEnclosingTransferObject(final String name);
59
60     /**
61      * Adds String definition of comment into Method Signature definition.
62      * <br>
63      * The comment String MUST NOT contain anny comment specific chars (i.e.
64      * "/**" or "//") just plain String text description.
65      *
66      * @param comment Comment String.
67      */
68     public void addComment(final String comment);
69
70      /**
71      * The method creates new AnnotationTypeBuilder containing specified
72      * package name an annotation name.
73      * <br>
74      * Neither the package name or annotation name can contain
75      * <code>null</code> references. In case that
76      * any of parameters contains <code>null</code> the method SHOULD thrown
77      * {@link IllegalArgumentException}
78      *
79      * @param packageName Package Name of Annotation Type
80      * @param name Name of Annotation Type
81      * @return <code>new</code> instance of Annotation Type Builder.
82      */
83     public AnnotationTypeBuilder addAnnotation(final String packageName, final String name);
84
85     /**
86      * Sets the <code>abstract</code> flag to define Generated Type as <i>abstract</i> type.
87      *
88      * @param isAbstract abstract flag
89      */
90     public void setAbstract(boolean isAbstract);
91
92     /**
93      * Add Type to implements.
94      *
95      * @param genType Type to implement
96      * @return <code>true</code> if the addition of type is successful.
97      */
98     public boolean addImplementsType(final Type genType);
99
100     /**
101      * Adds Constant definition and returns <code>new</code> Constant instance.
102      * <br>
103      * By definition Constant MUST be defined by return Type,
104      * Name and assigned value. The name SHOULD be defined with cpaital
105      * letters. Neither of method parameters can be <code>null</code> and the
106      * method SHOULD throw {@link IllegalArgumentException} if the contract
107      * is broken.
108      *
109      * @param type Constant Type
110      * @param name Name of Constant
111      * @param value Assigned Value
112      * @return <code>new</code> Constant instance.
113      */
114     public Constant addConstant(final Type type, final String name,
115             final Object value);
116
117     /**
118      * Adds new Enumeration definition for Generated Type Builder and returns
119      * Enum Builder for specifying all Enum parameters.
120      * <br>
121      * If there is already Enumeration stored with the same name,
122      * the old enum will be simply overwritten byt new enum definition.
123      * <br>
124      * Name of Enumeration cannot be <code>null</code>,
125      * if it is <code>null</code> the method SHOULD throw {@link IllegalArgumentException}
126      *
127      * @param name Enumeration Name
128      * @return <code>new</code> instance of Enumeration Builder.
129      */
130     public EnumBuilder addEnumeration(final String name);
131
132     /**
133      * Add new Method Signature definition for Generated Type Builder and
134      * returns Method Signature Builder for specifying all Method parameters.
135      * <br>
136      * Name of Method cannot be <code>null</code>,
137      * if it is <code>null</code> the method SHOULD throw {@link IllegalArgumentException}
138      * <br>
139      * By <i>Default</i> the MethodSignatureBuilder SHOULD be pre-set as
140      * {@link MethodSignatureBuilder#setAbstract(true)}, {@link MethodSignatureBuilder#setFinal(false)} and
141      * {@link MethodSignatureBuilder#setAccessModifier(PUBLIC)}
142      *
143      * @param name Name of Method
144      * @return <code>new</code> instance of Method Signature Builder.
145      */
146     public MethodSignatureBuilder addMethod(final String name);
147
148     /**
149      * Returns the <code>new</code> <i>immutable</i> instance of Generated
150      * Type.
151      *
152      * @return the <code>new</code> <i>immutable</i> instance of Generated
153      * Type.
154      */
155     public GeneratedType toInstance();
156 }