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