2 * Copyright (c) 2014 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
8 package org.opendaylight.mdsal.binding.model.api.type.builder;
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;
19 public interface GeneratedTypeBuilderBase<T extends GeneratedTypeBuilderBase<T>> extends Type {
22 * Adds new Enclosing Transfer Object into definition of Generated Type and
23 * returns <code>new</code> Instance of Generated TO Builder. <br>
24 * There is no need of specifying of Package Name because enclosing Type is
25 * already defined inside Generated Type with specific package name. <br>
26 * The name of enclosing Type cannot be same as Name of parent type and if
27 * there is already defined enclosing type with the same name, the new
28 * enclosing type will simply overwrite the older definition. <br>
29 * If the name of enclosing type is <code>null</code> the method SHOULD
30 * throw {@link IllegalArgumentException}
33 * Name of Enclosing Type
34 * @return <code>new</code> Instance of Generated Type Builder.
36 GeneratedTOBuilder addEnclosingTransferObject(String name);
39 * Adds new Enclosing Transfer Object <code>genTOBuilder</code> into
40 * definition of Generated Type
43 * There is no need of specifying of Package Name because enclosing Type is
44 * already defined inside Generated Type with specific package name. <br>
45 * The name of enclosing Type cannot be same as Name of parent type and if
46 * there is already defined enclosing type with the same name, the new
47 * enclosing type will simply overwrite the older definition. <br>
48 * If the parameter <code>genTOBuilder</code> of enclosing type is
49 * <code>null</code> the method SHOULD throw
50 * {@link IllegalArgumentException}
53 * Name of Enclosing Type
55 T addEnclosingTransferObject(GeneratedTOBuilder genTOBuilder);
58 * Adds String definition of comment into Method Signature definition. <br>
59 * The comment String MUST NOT contain any comment specific chars (i.e.
60 * "/**" or "//") just plain String text description.
65 T addComment(TypeComment comment);
68 * The method creates new AnnotationTypeBuilder containing specified package
69 * name an annotation name. <br>
70 * Neither the package name or annotation name can contain <code>null</code>
71 * references. In case that any of parameters contains <code>null</code> the
72 * method SHOULD thrown {@link IllegalArgumentException}
75 * Package Name of Annotation Type
77 * Name of Annotation Type
78 * @return <code>new</code> instance of Annotation Type Builder.
80 AnnotationTypeBuilder addAnnotation(String packageName, String name);
85 * Sets the <code>abstract</code> flag to define Generated Type as
86 * <i>abstract</i> type.
91 T setAbstract(boolean isAbstract);
93 List<Type> getImplementsTypes();
96 * Add Type to implements.
100 * @return <code>true</code> if the addition of type is successful.
102 T addImplementsType(Type genType);
105 * Adds Constant definition and returns <code>new</code> Constant instance. <br>
106 * By definition Constant MUST be defined by return Type, Name and assigned
107 * value. The name SHOULD be defined with capital letters. Neither of method
108 * parameters can be <code>null</code> and the method SHOULD throw
109 * {@link IllegalArgumentException} if the contract is broken.
117 * @return <code>new</code> Constant instance.
119 Constant addConstant(Type type, String name, Object value);
122 * Adds new Enumeration definition for Generated Type Builder and returns
123 * Enum Builder for specifying all Enum parameters. <br>
124 * If there is already Enumeration stored with the same name, the old enum
125 * will be simply overwritten byt new enum definition. <br>
126 * Name of Enumeration cannot be <code>null</code>, if it is
127 * <code>null</code> the method SHOULD throw
128 * {@link IllegalArgumentException}
132 * @return <code>new</code> instance of Enumeration Builder.
134 EnumBuilder addEnumeration(String name);
136 List<MethodSignatureBuilder> getMethodDefinitions();
139 * Add new Method Signature definition for Generated Type Builder and
140 * returns Method Signature Builder for specifying all Method parameters. <br>
141 * Name of Method cannot be <code>null</code>, if it is <code>null</code>
142 * the method SHOULD throw {@link IllegalArgumentException} <br>
143 * By <i>Default</i> the MethodSignatureBuilder SHOULD be pre-set as
144 * {@link MethodSignatureBuilder#setAbstract(boolean)},
145 * {TypeMemberBuilder#setFinal(boolean)} and
146 * {TypeMemberBuilder#setAccessModifier(boolean)}
150 * @return <code>new</code> instance of Method Signature Builder.
152 MethodSignatureBuilder addMethod(String name);
155 * Checks if GeneratedTypeBuilder contains method with name
156 * <code>methodName</code>
161 boolean containsMethod(String methodName);
163 List<GeneratedPropertyBuilder> getProperties();
166 * Returns the YANG definition of this type, if available.
168 * @return YANG source definition, or empty when unavailable.
170 Optional<YangSourceDefinition> getYangSourceDefinition();
173 * Add new Generated Property definition for Generated Transfer Object
174 * Builder and returns Generated Property Builder for specifying Property. <br>
175 * Name of Property cannot be <code>null</code>, if it is <code>null</code>
176 * the method SHOULD throw {@link IllegalArgumentException}
180 * @return <code>new</code> instance of Generated Property Builder.
182 GeneratedPropertyBuilder addProperty(String name);
185 * Check whether GeneratedTOBuilder contains property with name
189 * of property which existance is checked
190 * @return true if property <code>name</code> exists in list of properties.
192 boolean containsProperty(String name);
195 * Set a string that contains a human-readable textual description of type
199 * a string that contains a human-readable textual description of
202 void setDescription(String description);
205 * Set the name of the module, in which generated type was specified.
208 * the name of the module
210 void setModuleName(String moduleName);
213 * Schema path in schema tree from actual concrete type to the root.
215 * @param schemaPath schema path in schema tree
217 void setSchemaPath(SchemaPath schemaPath);
220 * Set a string that is used to specify a textual cross-reference to an
221 * external document, either another module that defines related management
222 * information, or a document that provides additional information relevant
223 * to this definition.
226 * a textual cross-reference to an external document.
228 void setReference(String reference);
231 * Set the YANG source definition.
233 * @param definition YANG source definition, must not be null
235 void setYangSourceDefinition(@NonNull YangSourceDefinition definition);