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, AnnotableTypeBuilder {
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);
70 * Sets the <code>abstract</code> flag to define Generated Type as
71 * <i>abstract</i> type.
76 T setAbstract(boolean isAbstract);
78 List<Type> getImplementsTypes();
81 * Add Type to implements.
85 * @return <code>true</code> if the addition of type is successful.
87 T addImplementsType(Type genType);
90 * Adds Constant definition and returns <code>new</code> Constant instance. <br>
91 * By definition Constant MUST be defined by return Type, Name and assigned
92 * value. The name SHOULD be defined with capital letters. Neither of method
93 * parameters can be <code>null</code> and the method SHOULD throw
94 * {@link IllegalArgumentException} if the contract is broken.
102 * @return <code>new</code> Constant instance.
104 Constant addConstant(Type type, String name, Object value);
107 * Adds new Enumeration definition for Generated Type Builder and returns
108 * Enum Builder for specifying all Enum parameters. <br>
109 * If there is already Enumeration stored with the same name, the old enum
110 * will be simply overwritten byt new enum definition. <br>
111 * Name of Enumeration cannot be <code>null</code>, if it is
112 * <code>null</code> the method SHOULD throw
113 * {@link IllegalArgumentException}
117 * @return <code>new</code> instance of Enumeration Builder.
119 EnumBuilder addEnumeration(String name);
121 List<MethodSignatureBuilder> getMethodDefinitions();
124 * Add new Method Signature definition for Generated Type Builder and
125 * returns Method Signature Builder for specifying all Method parameters. <br>
126 * Name of Method cannot be <code>null</code>, if it is <code>null</code>
127 * the method SHOULD throw {@link IllegalArgumentException} <br>
128 * By <i>Default</i> the MethodSignatureBuilder SHOULD be pre-set as
129 * {@link MethodSignatureBuilder#setAbstract(boolean)},
130 * {TypeMemberBuilder#setFinal(boolean)} and
131 * {TypeMemberBuilder#setAccessModifier(boolean)}
135 * @return <code>new</code> instance of Method Signature Builder.
137 MethodSignatureBuilder addMethod(String name);
140 * Checks if GeneratedTypeBuilder contains method with name
141 * <code>methodName</code>
146 boolean containsMethod(String methodName);
148 List<GeneratedPropertyBuilder> getProperties();
151 * Returns the YANG definition of this type, if available.
153 * @return YANG source definition, or empty when unavailable.
155 Optional<YangSourceDefinition> getYangSourceDefinition();
158 * Add new Generated Property definition for Generated Transfer Object
159 * Builder and returns Generated Property Builder for specifying Property. <br>
160 * Name of Property cannot be <code>null</code>, if it is <code>null</code>
161 * the method SHOULD throw {@link IllegalArgumentException}
165 * @return <code>new</code> instance of Generated Property Builder.
167 GeneratedPropertyBuilder addProperty(String name);
170 * Check whether GeneratedTOBuilder contains property with name
174 * of property which existance is checked
175 * @return true if property <code>name</code> exists in list of properties.
177 boolean containsProperty(String name);
180 * Set a string that contains a human-readable textual description of type
184 * a string that contains a human-readable textual description of
187 void setDescription(String description);
190 * Set the name of the module, in which generated type was specified.
193 * the name of the module
195 void setModuleName(String moduleName);
198 * Schema path in schema tree from actual concrete type to the root.
200 * @param schemaPath schema path in schema tree
202 void setSchemaPath(SchemaPath schemaPath);
205 * Set a string that is used to specify a textual cross-reference to an
206 * external document, either another module that defines related management
207 * information, or a document that provides additional information relevant
208 * to this definition.
211 * a textual cross-reference to an external document.
213 void setReference(String reference);
216 * Set the YANG source definition.
218 * @param definition YANG source definition, must not be null
220 void setYangSourceDefinition(@NonNull YangSourceDefinition definition);