Integrate JavaTypeName as Identifier
[mdsal.git] / binding / mdsal-binding-generator-api / src / main / java / org / opendaylight / mdsal / binding / model / api / type / builder / GeneratedTypeBuilderBase.java
1 /*
2  * Copyright (c) 2014 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.mdsal.binding.model.api.type.builder;
9
10 import java.util.List;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.binding.model.api.Constant;
14 import org.opendaylight.mdsal.binding.model.api.Type;
15 import org.opendaylight.mdsal.binding.model.api.TypeComment;
16 import org.opendaylight.mdsal.binding.model.api.YangSourceDefinition;
17 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
18
19 public interface GeneratedTypeBuilderBase<T extends GeneratedTypeBuilderBase<T>> extends Type, AnnotableTypeBuilder {
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 any comment specific chars (i.e.
60      * "/**" or "//") just plain String text description.
61      *
62      * @param comment
63      *            Comment String.
64      */
65     T addComment(TypeComment comment);
66
67     boolean isAbstract();
68
69     /**
70      * Sets the <code>abstract</code> flag to define Generated Type as
71      * <i>abstract</i> type.
72      *
73      * @param isAbstract
74      *            abstract flag
75      */
76     T setAbstract(boolean isAbstract);
77
78     List<Type> getImplementsTypes();
79
80     /**
81      * Add Type to implements.
82      *
83      * @param genType
84      *            Type to implement
85      * @return <code>true</code> if the addition of type is successful.
86      */
87     T addImplementsType(Type genType);
88
89     /**
90      * Adds Constant definition and returns <code>new</code> Constant instance. <br>
91      * By definition Constant MUST be defined by return Type, Name and assigned
92      * value. The name SHOULD be defined with capital letters. Neither of method
93      * parameters can be <code>null</code> and the method SHOULD throw
94      * {@link IllegalArgumentException} if the contract is broken.
95      *
96      * @param type
97      *            Constant Type
98      * @param name
99      *            Name of Constant
100      * @param value
101      *            Assigned Value
102      * @return <code>new</code> Constant instance.
103      */
104     Constant addConstant(Type type, String name, Object value);
105
106     /**
107      * Adds new Enumeration definition for Generated Type Builder and returns
108      * Enum Builder for specifying all Enum parameters. <br>
109      * If there is already Enumeration stored with the same name, the old enum
110      * will be simply overwritten byt new enum definition. <br>
111      * Name of Enumeration cannot be <code>null</code>, if it is
112      * <code>null</code> the method SHOULD throw
113      * {@link IllegalArgumentException}
114      *
115      * @param name
116      *            Enumeration Name
117      * @return <code>new</code> instance of Enumeration Builder.
118      */
119     EnumBuilder addEnumeration(String name);
120
121     List<MethodSignatureBuilder> getMethodDefinitions();
122
123     /**
124      * Add new Method Signature definition for Generated Type Builder and
125      * returns Method Signature Builder for specifying all Method parameters. <br>
126      * Name of Method cannot be <code>null</code>, if it is <code>null</code>
127      * the method SHOULD throw {@link IllegalArgumentException} <br>
128      * By <i>Default</i> the MethodSignatureBuilder SHOULD be pre-set as
129      * {@link MethodSignatureBuilder#setAbstract(boolean)},
130      * {TypeMemberBuilder#setFinal(boolean)} and
131      * {TypeMemberBuilder#setAccessModifier(boolean)}
132      *
133      * @param name
134      *            Name of Method
135      * @return <code>new</code> instance of Method Signature Builder.
136      */
137     MethodSignatureBuilder addMethod(String name);
138
139     /**
140      * Checks if GeneratedTypeBuilder contains method with name
141      * <code>methodName</code>
142      *
143      * @param methodName
144      *            is method name
145      */
146     boolean containsMethod(String methodName);
147
148     List<GeneratedPropertyBuilder> getProperties();
149
150     /**
151      * Returns the YANG definition of this type, if available.
152      *
153      * @return YANG source definition, or empty when unavailable.
154      */
155     Optional<YangSourceDefinition> getYangSourceDefinition();
156
157     /**
158      * Add new Generated Property definition for Generated Transfer Object
159      * Builder and returns Generated Property Builder for specifying Property. <br>
160      * Name of Property cannot be <code>null</code>, if it is <code>null</code>
161      * the method SHOULD throw {@link IllegalArgumentException}
162      *
163      * @param name
164      *            Name of Property
165      * @return <code>new</code> instance of Generated Property Builder.
166      */
167     GeneratedPropertyBuilder addProperty(String name);
168
169     /**
170      * Check whether GeneratedTOBuilder contains property with name
171      * <code>name</code>
172      *
173      * @param name
174      *            of property which existance is checked
175      * @return true if property <code>name</code> exists in list of properties.
176      */
177     boolean containsProperty(String name);
178
179     /**
180      * Set a string that contains a human-readable textual description of type
181      * definition.
182      *
183      * @param description
184      *            a string that contains a human-readable textual description of
185      *            type definition.
186      */
187     void setDescription(String description);
188
189     /**
190      * Set the name of the module, in which generated type was specified.
191      *
192      * @param moduleName
193      *            the name of the module
194      */
195     void setModuleName(String moduleName);
196
197     /**
198      * Schema path in schema tree from actual concrete type to the root.
199      *
200      * @param schemaPath schema path in schema tree
201      */
202     void setSchemaPath(SchemaPath schemaPath);
203
204     /**
205      * Set a string that is used to specify a textual cross-reference to an
206      * external document, either another module that defines related management
207      * information, or a document that provides additional information relevant
208      * to this definition.
209      *
210      * @param reference
211      *            a textual cross-reference to an external document.
212      */
213     void setReference(String reference);
214
215     /**
216      * Set the YANG source definition.
217      *
218      * @param definition YANG source definition, must not be null
219      */
220     void setYangSourceDefinition(@NonNull YangSourceDefinition definition);
221 }