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