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