d7d78f466c0bfcff6d7e1d229901b0744428d9fb
[yangtools.git] / code-generator / binding-model-api / src / main / java / org / opendaylight / yangtools / sal / binding / model / api / type / builder / GeneratedTypeBuilder.java
1 /*\r
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 package org.opendaylight.yangtools.sal.binding.model.api.type.builder;\r
9 \r
10 import org.opendaylight.yangtools.sal.binding.model.api.Constant;\r
11 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedType;\r
12 import org.opendaylight.yangtools.sal.binding.model.api.Type;\r
13 \r
14 /**\r
15  * Generated Type Builder interface is helper interface for building and\r
16  * defining the GeneratedType.\r
17  * \r
18  * @see GeneratedType\r
19  */\r
20 public interface GeneratedTypeBuilder extends Type {\r
21 \r
22     /**\r
23      * Adds new Enclosing Type into definition of Generated Type and returns\r
24      * <code>new</code> Instance of Generated Type Builder. <br>\r
25      * There is no need of specifying of Package Name because enclosing Type is\r
26      * already defined inside Generated Type with specific package name. <br>\r
27      * The name of enclosing Type cannot be same as Name of parent type and if\r
28      * there is already defined enclosing type with the same name, the new\r
29      * enclosing type will simply overwrite the older definition. <br>\r
30      * If the name of enclosing type is <code>null</code> the method SHOULD\r
31      * throw {@link IllegalArgumentException}\r
32      * \r
33      * @param name\r
34      *            Name of Enclosing Type\r
35      * @return <code>new</code> Instance of Generated Type Builder.\r
36      */\r
37     public GeneratedTypeBuilder addEnclosingType(final String name);\r
38 \r
39     /**\r
40      * Adds new Enclosing Transfer Object into definition of Generated Type and\r
41      * returns <code>new</code> Instance of Generated TO Builder. <br>\r
42      * There is no need of specifying of Package Name because enclosing Type is\r
43      * already defined inside Generated Type with specific package name. <br>\r
44      * The name of enclosing Type cannot be same as Name of parent type and if\r
45      * there is already defined enclosing type with the same name, the new\r
46      * enclosing type will simply overwrite the older definition. <br>\r
47      * If the name of enclosing type is <code>null</code> the method SHOULD\r
48      * throw {@link IllegalArgumentException}\r
49      * \r
50      * @param name\r
51      *            Name of Enclosing Type\r
52      * @return <code>new</code> Instance of Generated Type Builder.\r
53      */\r
54     public GeneratedTOBuilder addEnclosingTransferObject(final String name);\r
55 \r
56     /**\r
57      * Adds new Enclosing Transfer Object <code>genTOBuilder</code> into\r
58      * definition of Generated Type\r
59      * \r
60      * <br>\r
61      * There is no need of specifying of Package Name because enclosing Type is\r
62      * already defined inside Generated Type with specific package name. <br>\r
63      * The name of enclosing Type cannot be same as Name of parent type and if\r
64      * there is already defined enclosing type with the same name, the new\r
65      * enclosing type will simply overwrite the older definition. <br>\r
66      * If the parameter <code>genTOBuilder</code> of enclosing type is\r
67      * <code>null</code> the method SHOULD throw\r
68      * {@link IllegalArgumentException}\r
69      * \r
70      * @param <code>genTOBuilder</code> Name of Enclosing Type\r
71      */\r
72     public void addEnclosingTransferObject(final GeneratedTOBuilder genTOBuilder);\r
73 \r
74     /**\r
75      * Adds String definition of comment into Method Signature definition. <br>\r
76      * The comment String MUST NOT contain anny comment specific chars (i.e.\r
77      * "/**" or "//") just plain String text description.\r
78      * \r
79      * @param comment\r
80      *            Comment String.\r
81      */\r
82     public void addComment(final String comment);\r
83 \r
84     /**\r
85      * The method creates new AnnotationTypeBuilder containing specified package\r
86      * name an annotation name. <br>\r
87      * Neither the package name or annotation name can contain <code>null</code>\r
88      * references. In case that any of parameters contains <code>null</code> the\r
89      * method SHOULD thrown {@link IllegalArgumentException}\r
90      * \r
91      * @param packageName\r
92      *            Package Name of Annotation Type\r
93      * @param name\r
94      *            Name of Annotation Type\r
95      * @return <code>new</code> instance of Annotation Type Builder.\r
96      */\r
97     public AnnotationTypeBuilder addAnnotation(final String packageName, final String name);\r
98 \r
99     /**\r
100      * Sets the <code>abstract</code> flag to define Generated Type as\r
101      * <i>abstract</i> type.\r
102      * \r
103      * @param isAbstract\r
104      *            abstract flag\r
105      */\r
106     public void setAbstract(boolean isAbstract);\r
107 \r
108     /**\r
109      * Add Type to implements.\r
110      * \r
111      * @param genType\r
112      *            Type to implement\r
113      * @return <code>true</code> if the addition of type is successful.\r
114      */\r
115     public boolean addImplementsType(final Type genType);\r
116 \r
117     /**\r
118      * Adds Constant definition and returns <code>new</code> Constant instance. <br>\r
119      * By definition Constant MUST be defined by return Type, Name and assigned\r
120      * value. The name SHOULD be defined with cpaital letters. Neither of method\r
121      * parameters can be <code>null</code> and the method SHOULD throw\r
122      * {@link IllegalArgumentException} if the contract is broken.\r
123      * \r
124      * @param type\r
125      *            Constant Type\r
126      * @param name\r
127      *            Name of Constant\r
128      * @param value\r
129      *            Assigned Value\r
130      * @return <code>new</code> Constant instance.\r
131      */\r
132     public Constant addConstant(final Type type, final String name, final Object value);\r
133 \r
134     /**\r
135      * Adds new Enumeration definition for Generated Type Builder and returns\r
136      * Enum Builder for specifying all Enum parameters. <br>\r
137      * If there is already Enumeration stored with the same name, the old enum\r
138      * will be simply overwritten byt new enum definition. <br>\r
139      * Name of Enumeration cannot be <code>null</code>, if it is\r
140      * <code>null</code> the method SHOULD throw\r
141      * {@link IllegalArgumentException}\r
142      * \r
143      * @param name\r
144      *            Enumeration Name\r
145      * @return <code>new</code> instance of Enumeration Builder.\r
146      */\r
147     public EnumBuilder addEnumeration(final String name);\r
148 \r
149     /**\r
150      * Add new Method Signature definition for Generated Type Builder and\r
151      * returns Method Signature Builder for specifying all Method parameters. <br>\r
152      * Name of Method cannot be <code>null</code>, if it is <code>null</code>\r
153      * the method SHOULD throw {@link IllegalArgumentException} <br>\r
154      * By <i>Default</i> the MethodSignatureBuilder SHOULD be pre-set as\r
155      * {@link MethodSignatureBuilder#setAbstract(true)},\r
156      * {@link MethodSignatureBuilder#setFinal(false)} and\r
157      * {@link MethodSignatureBuilder#setAccessModifier(PUBLIC)}\r
158      * \r
159      * @param name\r
160      *            Name of Method\r
161      * @return <code>new</code> instance of Method Signature Builder.\r
162      */\r
163     public MethodSignatureBuilder addMethod(final String name);\r
164 \r
165     /**\r
166      * Checks if GeneratedTypeBuilder contains method with name\r
167      * <code>methodName</code>\r
168      * \r
169      * @param methodName\r
170      *            is method name\r
171      */\r
172     public boolean containsMethod(final String methodName);\r
173     \r
174     /**\r
175      * Add new Generated Property definition for Generated Transfer Object\r
176      * Builder and returns Generated Property Builder for specifying Property. <br>\r
177      * Name of Property cannot be <code>null</code>, if it is <code>null</code>\r
178      * the method SHOULD throw {@link IllegalArgumentException}\r
179      * \r
180      * @param name\r
181      *            Name of Property\r
182      * @return <code>new</code> instance of Generated Property Builder.\r
183      */\r
184     public GeneratedPropertyBuilder addProperty(final String name);\r
185 \r
186     /**\r
187      * Check whether GeneratedTOBuilder contains property with name\r
188      * <code>name</code>\r
189      * \r
190      * @param name\r
191      *            of property which existance is checked\r
192      * @return true if property <code>name</code> exists in list of properties.\r
193      */\r
194     public boolean containsProperty(final String name);\r
195 \r
196     /**\r
197      * Returns the <code>new</code> <i>immutable</i> instance of Generated Type.\r
198      * \r
199      * @return the <code>new</code> <i>immutable</i> instance of Generated Type.\r
200      */\r
201     public GeneratedType toInstance();\r
202 }\r