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