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