2 * Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.mdsal.binding.javav2.model.api.type.builder;
11 import com.google.common.annotations.Beta;
12 import java.util.List;
13 import java.util.Optional;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.opendaylight.mdsal.binding.javav2.generator.context.ModuleContext;
16 import org.opendaylight.mdsal.binding.javav2.model.api.Constant;
17 import org.opendaylight.mdsal.binding.javav2.model.api.Type;
18 import org.opendaylight.mdsal.binding.javav2.model.api.TypeComment;
19 import org.opendaylight.mdsal.binding.javav2.model.api.YangSourceDefinition;
20 import org.opendaylight.yangtools.yang.common.QName;
23 public interface GeneratedTypeBuilderBase<T extends GeneratedTypeBuilderBase<T>> extends Type {
26 * Adds new Enclosing Transfer Object into definition of Generated Type and
27 * returns <code>new</code> Instance of Generated TO Builder. <br>
28 * There is no need of specifying of Package Name because enclosing Type is
29 * already defined inside Generated Type with specific package name. <br>
30 * The name of enclosing Type cannot be same as Name of parent type and if
31 * there is already defined enclosing type with the same name, the new
32 * enclosing type will simply overwrite the older definition. <br>
33 * If the name of enclosing type is <code>null</code> the method SHOULD
34 * throw {@link IllegalArgumentException}
37 * Name of Enclosing Type
38 * @return <code>new</code> Instance of Generated Type Builder.
40 GeneratedTOBuilder addEnclosingTransferObject(String name);
43 * Adds new Enclosing Transfer Object <code>genTOBuilder</code> into
44 * definition of Generated Type
47 * There is no need of specifying of Package Name because enclosing Type is
48 * already defined inside Generated Type with specific package name. <br>
49 * The name of enclosing Type cannot be same as Name of parent type and if
50 * there is already defined enclosing type with the same name, the new
51 * enclosing type will simply overwrite the older definition. <br>
52 * If the parameter <code>genTOBuilder</code> of enclosing type is
53 * <code>null</code> the method SHOULD throw
54 * {@link IllegalArgumentException}
57 * Name of Enclosing Type
59 T addEnclosingTransferObject(GeneratedTOBuilder genTOBuilder);
62 * Adds String definition of comment into Method Signature definition. <br>
63 * The comment String MUST NOT contain anny comment specific chars (i.e.
64 * "/**" or "//") just plain String text description.
69 T addComment(TypeComment comment);
72 * The method creates new AnnotationTypeBuilder containing specified package
73 * name an annotation name. <br>
74 * Neither the package name or annotation name can contain <code>null</code>
75 * references. In case that any of parameters contains <code>null</code> the
76 * method SHOULD thrown {@link IllegalArgumentException}
79 * Package Name of Annotation Type
81 * Name of Annotation Type
82 * @return <code>new</code> instance of Annotation Type Builder.
84 AnnotationTypeBuilder addAnnotation(String packageName, String name);
89 * Sets the <code>abstract</code> flag to define Generated Type as
90 * <i>abstract</i> type.
95 T setAbstract(boolean isAbstract);
97 List<Type> getImplementsTypes();
100 * Add Type to implements.
104 * @return <code>true</code> if the addition of type is successful.
106 T addImplementsType(Type genType);
109 * Adds Constant definition and returns <code>new</code> Constant instance. <br>
110 * By definition Constant MUST be defined by return Type, Name and assigned
111 * value. The name SHOULD be defined with capital letters. Neither of method
112 * parameters can be <code>null</code> and the method SHOULD throw
113 * {@link IllegalArgumentException} if the contract is broken.
121 * @return <code>new</code> Constant instance.
123 Constant addConstant(Type type, String name, Object value);
126 * Adds new Enumeration definition for Generated Type Builder and returns
127 * Enum Builder for specifying all Enum parameters. <br>
128 * If there is already Enumeration stored with the same name, the old enum
129 * will be simply overwritten byt new enum definition. <br>
130 * Name of Enumeration cannot be <code>null</code>, if it is
131 * <code>null</code> the method SHOULD throw
132 * {@link IllegalArgumentException}
136 * @return <code>new</code> instance of Enumeration Builder.
138 EnumBuilder addEnumeration(String name, ModuleContext context);
141 * Gets parent type for data schema node builder, the parent
142 * MUST be a data tree node.
144 * @return parent generated type of tree node
146 Type getParentTypeForBuilder();
149 * Sets parent type for data schema node builder, the parent
150 * MUST be a data tree node.
152 * @param type parent generated type of tree node
153 * @return parent generated type
155 Type setParentTypeForBuilder(Type type);
157 List<MethodSignatureBuilder> getMethodDefinitions();
160 * Add new Method Signature definition for Generated Type Builder and
161 * returns Method Signature Builder for specifying all Method parameters. <br>
162 * Name of Method cannot be <code>null</code>, if it is <code>null</code>
163 * the method SHOULD throw {@link IllegalArgumentException} <br>
164 * By <i>Default</i> the MethodSignatureBuilder SHOULD be pre-set as
165 * {@link MethodSignatureBuilder#setAbstract(boolean)},
166 * {TypeMemberBuilder#setFinal(boolean)} and
167 * {TypeMemberBuilder#setAccessModifier(boolean)}
171 * @return <code>new</code> instance of Method Signature Builder.
173 MethodSignatureBuilder addMethod(String name);
176 * Checks if GeneratedTypeBuilder contains method with name
177 * <code>methodName</code>
182 boolean containsMethod(String methodName);
184 List<GeneratedPropertyBuilder> getProperties();
187 * Returns the YANG definition of this type, if available.
189 * @return YANG source definition, or empty when unavailable.
191 Optional<YangSourceDefinition> getYangSourceDefinition();
194 * Add new Generated Property definition for Generated Transfer Object
195 * Builder and returns Generated Property Builder for specifying Property. <br>
196 * Name of Property cannot be <code>null</code>, if it is <code>null</code>
197 * the method SHOULD throw {@link IllegalArgumentException}
201 * @return <code>new</code> instance of Generated Property Builder.
203 GeneratedPropertyBuilder addProperty(String name);
206 * Check whether GeneratedTOBuilder contains property with name
210 * of property which existance is checked
211 * @return true if property <code>name</code> exists in list of properties.
213 boolean containsProperty(String name);
216 * Set a string that contains a human-readable textual description of type
220 * a string that contains a human-readable textual description of
223 void setDescription(String description);
226 * Set the name of the module, in which generated type was specified.
229 * the name of the module
231 void setModuleName(String moduleName);
234 * Set a list of QNames which represent schema path in schema tree from
235 * actual concrete type to the root.
238 * a list of QNames which represent schema path in schema tree
240 void setSchemaPath(List<QName> schemaPath);
243 * Set a string that is used to specify a textual cross-reference to an
244 * external document, either another module that defines related management
245 * information, or a document that provides additional information relevant
246 * to this definition.
249 * a textual cross-reference to an external document.
251 void setReference(String reference);
254 * Set the YANG source definition.
256 * @param definition YANG source definition, must not be null
258 void setYangSourceDefinition(@NonNull YangSourceDefinition definition);