Code generator prototype - Binding specification v2
[mdsal.git] / binding2 / mdsal-binding2-generator-api / src / main / java / org / opendaylight / mdsal / binding / javav2 / model / api / type / builder / GeneratedTypeBuilderBase.java
1 /*
2  * Copyright (c) 2017 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.binding.javav2.model.api.type.builder;
10
11 import com.google.common.annotations.Beta;
12 import java.util.List;
13 import org.opendaylight.mdsal.binding.javav2.model.api.Constant;
14 import org.opendaylight.mdsal.binding.javav2.model.api.Type;
15 import org.opendaylight.yangtools.yang.common.QName;
16
17 @Beta
18 public interface GeneratedTypeBuilderBase<T extends GeneratedTypeBuilderBase<T>> extends Type {
19
20     /**
21      * Adds new Enclosing Transfer Object into definition of Generated Type and
22      * returns <code>new</code> Instance of Generated TO Builder. <br>
23      * There is no need of specifying of Package Name because enclosing Type is
24      * already defined inside Generated Type with specific package name. <br>
25      * The name of enclosing Type cannot be same as Name of parent type and if
26      * there is already defined enclosing type with the same name, the new
27      * enclosing type will simply overwrite the older definition. <br>
28      * If the name of enclosing type is <code>null</code> the method SHOULD
29      * throw {@link IllegalArgumentException}
30      *
31      * @param name
32      *            Name of Enclosing Type
33      * @return <code>new</code> Instance of Generated Type Builder.
34      */
35     GeneratedTOBuilder addEnclosingTransferObject(String name);
36
37     /**
38      * Adds new Enclosing Transfer Object <code>genTOBuilder</code> into
39      * definition of Generated Type
40      *
41      * <br>
42      * There is no need of specifying of Package Name because enclosing Type is
43      * already defined inside Generated Type with specific package name. <br>
44      * The name of enclosing Type cannot be same as Name of parent type and if
45      * there is already defined enclosing type with the same name, the new
46      * enclosing type will simply overwrite the older definition. <br>
47      * If the parameter <code>genTOBuilder</code> of enclosing type is
48      * <code>null</code> the method SHOULD throw
49      * {@link IllegalArgumentException}
50      *
51      * @param genTOBuilder
52      *            Name of Enclosing Type
53      */
54     T addEnclosingTransferObject(GeneratedTOBuilder genTOBuilder);
55
56     /**
57      * Adds String definition of comment into Method Signature definition. <br>
58      * The comment String MUST NOT contain anny comment specific chars (i.e.
59      * "/**" or "//") just plain String text description.
60      *
61      * @param comment
62      *            Comment String.
63      */
64     T addComment(String comment);
65
66     /**
67      * The method creates new AnnotationTypeBuilder containing specified package
68      * name an annotation name. <br>
69      * Neither the package name or annotation name can contain <code>null</code>
70      * references. In case that any of parameters contains <code>null</code> the
71      * method SHOULD thrown {@link IllegalArgumentException}
72      *
73      * @param packageName
74      *            Package Name of Annotation Type
75      * @param name
76      *            Name of Annotation Type
77      * @return <code>new</code> instance of Annotation Type Builder.
78      */
79     AnnotationTypeBuilder addAnnotation(String packageName, String name);
80
81     boolean isAbstract();
82
83     /**
84      * Sets the <code>abstract</code> flag to define Generated Type as
85      * <i>abstract</i> type.
86      *
87      * @param isAbstract
88      *            abstract flag
89      */
90     T setAbstract(boolean isAbstract);
91
92     List<Type> getImplementsTypes();
93
94     /**
95      * Add Type to implements.
96      *
97      * @param genType
98      *            Type to implement
99      * @return <code>true</code> if the addition of type is successful.
100      */
101     T addImplementsType(Type genType);
102
103     /**
104      * Adds Constant definition and returns <code>new</code> Constant instance. <br>
105      * By definition Constant MUST be defined by return Type, Name and assigned
106      * value. The name SHOULD be defined with capital letters. Neither of method
107      * parameters can be <code>null</code> and the method SHOULD throw
108      * {@link IllegalArgumentException} if the contract is broken.
109      *
110      * @param type
111      *            Constant Type
112      * @param name
113      *            Name of Constant
114      * @param value
115      *            Assigned Value
116      * @return <code>new</code> Constant instance.
117      */
118     Constant addConstant(Type type, String name, Object value);
119
120     /**
121      * Adds new Enumeration definition for Generated Type Builder and returns
122      * Enum Builder for specifying all Enum parameters. <br>
123      * If there is already Enumeration stored with the same name, the old enum
124      * will be simply overwritten byt new enum definition. <br>
125      * Name of Enumeration cannot be <code>null</code>, if it is
126      * <code>null</code> the method SHOULD throw
127      * {@link IllegalArgumentException}
128      *
129      * @param name
130      *            Enumeration Name
131      * @return <code>new</code> instance of Enumeration Builder.
132      */
133     EnumBuilder addEnumeration(String name);
134
135     /**
136      * Sets parent type for data schema node node builder
137      *
138      * @param type generated parent type
139      * @return generated type
140      */
141     Type setParentTypeForBuilder(Type type);
142
143     List<MethodSignatureBuilder> getMethodDefinitions();
144
145     /**
146      * Add new Method Signature definition for Generated Type Builder and
147      * returns Method Signature Builder for specifying all Method parameters. <br>
148      * Name of Method cannot be <code>null</code>, if it is <code>null</code>
149      * the method SHOULD throw {@link IllegalArgumentException} <br>
150      * By <i>Default</i> the MethodSignatureBuilder SHOULD be pre-set as
151      * {@link MethodSignatureBuilder#setAbstract(boolean)},
152      * {TypeMemberBuilder#setFinal(boolean)} and
153      * {TypeMemberBuilder#setAccessModifier(boolean)}
154      *
155      * @param name
156      *            Name of Method
157      * @return <code>new</code> instance of Method Signature Builder.
158      */
159     MethodSignatureBuilder addMethod(String name);
160
161     /**
162      * Checks if GeneratedTypeBuilder contains method with name
163      * <code>methodName</code>
164      *
165      * @param methodName
166      *            is method name
167      */
168     boolean containsMethod(String methodName);
169
170     List<GeneratedPropertyBuilder> getProperties();
171
172     /**
173      * Add new Generated Property definition for Generated Transfer Object
174      * Builder and returns Generated Property Builder for specifying Property. <br>
175      * Name of Property cannot be <code>null</code>, if it is <code>null</code>
176      * the method SHOULD throw {@link IllegalArgumentException}
177      *
178      * @param name
179      *            Name of Property
180      * @return <code>new</code> instance of Generated Property Builder.
181      */
182     GeneratedPropertyBuilder addProperty(String name);
183
184     /**
185      * Check whether GeneratedTOBuilder contains property with name
186      * <code>name</code>
187      *
188      * @param name
189      *            of property which existance is checked
190      * @return true if property <code>name</code> exists in list of properties.
191      */
192     boolean containsProperty(String name);
193
194     /**
195      * Set a string that contains a human-readable textual description of type
196      * definition.
197      *
198      * @param description
199      *            a string that contains a human-readable textual description of
200      *            type definition.
201      */
202     void setDescription(String description);
203
204     /**
205      * Set the name of the module, in which generated type was specified.
206      *
207      * @param moduleName
208      *            the name of the module
209      */
210     void setModuleName(String moduleName);
211
212     /**
213      * Set a list of QNames which represent schema path in schema tree from
214      * actual concrete type to the root.
215      *
216      * @param schemaPath
217      *            a list of QNames which represent schema path in schema tree
218      */
219     void setSchemaPath(List<QName> schemaPath);
220
221     /**
222      * Set a string that is used to specify a textual cross-reference to an
223      * external document, either another module that defines related management
224      * information, or a document that provides additional information relevant
225      * to this definition.
226      *
227      * @param reference
228      *            a textual cross-reference to an external document.
229      */
230     void setReference(String reference);
231
232 }