Fixing sonar issues 2
[yangtools.git] / code-generator / binding-model-api / src / main / java / org / opendaylight / yangtools / sal / binding / model / api / type / builder / GeneratedTypeBuilderBase.java
1 package org.opendaylight.yangtools.sal.binding.model.api.type.builder;
2
3 import org.opendaylight.yangtools.sal.binding.model.api.Constant;
4 import org.opendaylight.yangtools.sal.binding.model.api.Type;
5
6 public interface GeneratedTypeBuilderBase<T extends GeneratedTypeBuilderBase<T>> extends Type {
7
8     /**
9      * Adds new Enclosing Transfer Object into definition of Generated Type and
10      * returns <code>new</code> Instance of Generated TO Builder. <br>
11      * There is no need of specifying of Package Name because enclosing Type is
12      * already defined inside Generated Type with specific package name. <br>
13      * The name of enclosing Type cannot be same as Name of parent type and if
14      * there is already defined enclosing type with the same name, the new
15      * enclosing type will simply overwrite the older definition. <br>
16      * If the name of enclosing type is <code>null</code> the method SHOULD
17      * throw {@link IllegalArgumentException}
18      * 
19      * @param name
20      *            Name of Enclosing Type
21      * @return <code>new</code> Instance of Generated Type Builder.
22      */
23     GeneratedTOBuilder addEnclosingTransferObject(final String name);
24
25     /**
26      * Adds new Enclosing Transfer Object <code>genTOBuilder</code> into
27      * definition of Generated Type
28      * 
29      * <br>
30      * There is no need of specifying of Package Name because enclosing Type is
31      * already defined inside Generated Type with specific package name. <br>
32      * The name of enclosing Type cannot be same as Name of parent type and if
33      * there is already defined enclosing type with the same name, the new
34      * enclosing type will simply overwrite the older definition. <br>
35      * If the parameter <code>genTOBuilder</code> of enclosing type is
36      * <code>null</code> the method SHOULD throw
37      * {@link IllegalArgumentException}
38      * 
39      * @param <code>genTOBuilder</code> Name of Enclosing Type
40      */
41     T addEnclosingTransferObject(final GeneratedTOBuilder genTOBuilder);
42
43     /**
44      * Adds String definition of comment into Method Signature definition. <br>
45      * The comment String MUST NOT contain anny comment specific chars (i.e.
46      * "/**" or "//") just plain String text description.
47      * 
48      * @param comment
49      *            Comment String.
50      */
51     T addComment(final String comment);
52
53     /**
54      * The method creates new AnnotationTypeBuilder containing specified package
55      * name an annotation name. <br>
56      * Neither the package name or annotation name can contain <code>null</code>
57      * references. In case that any of parameters contains <code>null</code> the
58      * method SHOULD thrown {@link IllegalArgumentException}
59      * 
60      * @param packageName
61      *            Package Name of Annotation Type
62      * @param name
63      *            Name of Annotation Type
64      * @return <code>new</code> instance of Annotation Type Builder.
65      */
66     AnnotationTypeBuilder addAnnotation(final String packageName, final String name);
67
68     /**
69      * Sets the <code>abstract</code> flag to define Generated Type as
70      * <i>abstract</i> type.
71      * 
72      * @param isAbstract
73      *            abstract flag
74      */
75     T setAbstract(boolean isAbstract);
76
77     /**
78      * Add Type to implements.
79      * 
80      * @param genType
81      *            Type to implement
82      * @return <code>true</code> if the addition of type is successful.
83      */
84     T addImplementsType(final Type genType);
85
86     /**
87      * Adds Constant definition and returns <code>new</code> Constant instance. <br>
88      * By definition Constant MUST be defined by return Type, Name and assigned
89      * value. The name SHOULD be defined with capital letters. Neither of method
90      * parameters can be <code>null</code> and the method SHOULD throw
91      * {@link IllegalArgumentException} if the contract is broken.
92      * 
93      * @param type
94      *            Constant Type
95      * @param name
96      *            Name of Constant
97      * @param value
98      *            Assigned Value
99      * @return <code>new</code> Constant instance.
100      */
101     Constant addConstant(final Type type, final String name, final Object value);
102
103     /**
104      * Adds new Enumeration definition for Generated Type Builder and returns
105      * Enum Builder for specifying all Enum parameters. <br>
106      * If there is already Enumeration stored with the same name, the old enum
107      * will be simply overwritten byt new enum definition. <br>
108      * Name of Enumeration cannot be <code>null</code>, if it is
109      * <code>null</code> the method SHOULD throw
110      * {@link IllegalArgumentException}
111      * 
112      * @param name
113      *            Enumeration Name
114      * @return <code>new</code> instance of Enumeration Builder.
115      */
116     EnumBuilder addEnumeration(final String name);
117
118     /**
119      * Add new Method Signature definition for Generated Type Builder and
120      * returns Method Signature Builder for specifying all Method parameters. <br>
121      * Name of Method cannot be <code>null</code>, if it is <code>null</code>
122      * the method SHOULD throw {@link IllegalArgumentException} <br>
123      * By <i>Default</i> the MethodSignatureBuilder SHOULD be pre-set as
124      * {@link MethodSignatureBuilder#setAbstract(true)},
125      * {@link MethodSignatureBuilder#setFinal(false)} and
126      * {@link MethodSignatureBuilder#setAccessModifier(PUBLIC)}
127      * 
128      * @param name
129      *            Name of Method
130      * @return <code>new</code> instance of Method Signature Builder.
131      */
132     MethodSignatureBuilder addMethod(final String name);
133
134     /**
135      * Checks if GeneratedTypeBuilder contains method with name
136      * <code>methodName</code>
137      * 
138      * @param methodName
139      *            is method name
140      */
141     boolean containsMethod(final String methodName);
142
143     /**
144      * Add new Generated Property definition for Generated Transfer Object
145      * Builder and returns Generated Property Builder for specifying Property. <br>
146      * Name of Property cannot be <code>null</code>, if it is <code>null</code>
147      * the method SHOULD throw {@link IllegalArgumentException}
148      * 
149      * @param name
150      *            Name of Property
151      * @return <code>new</code> instance of Generated Property Builder.
152      */
153     GeneratedPropertyBuilder addProperty(final String name);
154
155     /**
156      * Check whether GeneratedTOBuilder contains property with name
157      * <code>name</code>
158      * 
159      * @param name
160      *            of property which existance is checked
161      * @return true if property <code>name</code> exists in list of properties.
162      */
163     boolean containsProperty(final String name);
164
165 }