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