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 {
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}.
29 * @param name Name of Enclosing Type
30 * @return <code>new</code> Instance of Generated Type Builder.
32 GeneratedTOBuilder addEnclosingTransferObject(String name);
35 * Adds new Enclosing Transfer Object <code>genTOBuilder</code> into definition of Generated Type.
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}.
45 * @param genTOBuilder Name of Enclosing Type
47 T addEnclosingTransferObject(GeneratedTOBuilder genTOBuilder);
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
54 * @param comment Comment String.
56 T addComment(TypeComment comment);
61 * Sets the <code>abstract</code> flag to define Generated Type as <i>abstract</i> type.
63 * @param isAbstract abstract flag
65 T setAbstract(boolean isAbstract);
67 List<Type> getImplementsTypes();
70 * Add Type to implements.
72 * @param genType Type to implement
73 * @return <code>true</code> if the addition of type is successful.
75 T addImplementsType(Type genType);
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.
83 * @param type Constant Type
84 * @param name Name of Constant
85 * @param value Assigned Value
86 * @return <code>new</code> Constant instance.
88 Constant addConstant(Type type, String name, Object value);
91 * Adds new Enumeration definition for Generated Type Builder and returns Enum Builder for specifying all Enum
93 * If there is already Enumeration stored with the same name, the old enum will be simply overwritten byt new enum
95 * Name of Enumeration cannot be <code>null</code>, if it is <code>null</code> the method SHOULD throw
96 * {@link IllegalArgumentException}.
98 * @param name Enumeration Name
99 * @return <code>new</code> instance of Enumeration Builder.
101 EnumBuilder addEnumeration(String name);
103 List<MethodSignatureBuilder> getMethodDefinitions();
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)}
114 * @param name Name of Method
115 * @return <code>new</code> instance of Method Signature Builder.
117 MethodSignatureBuilder addMethod(String name);
120 * Checks if GeneratedTypeBuilder contains method with name <code>methodName</code>.
122 * @param methodName is method name
124 boolean containsMethod(String methodName);
126 List<GeneratedPropertyBuilder> getProperties();
129 * Returns the YANG definition of this type, if available.
131 * @return YANG source definition, or empty when unavailable.
133 Optional<YangSourceDefinition> getYangSourceDefinition();
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}.
141 * @param name Name of Property
142 * @return <code>new</code> instance of Generated Property Builder.
144 GeneratedPropertyBuilder addProperty(String name);
147 * Check whether GeneratedTOBuilder contains property with name <code>name</code>.
149 * @param name of property which existence is checked
150 * @return true if property <code>name</code> exists in list of properties.
152 boolean containsProperty(String name);
155 * Set a string that contains a human-readable textual description of type definition.
157 * @param description a string that contains a human-readable textual description of type definition.
159 void setDescription(String description);
162 * Set the name of the module, in which generated type was specified.
164 * @param moduleName the name of the module
166 void setModuleName(String moduleName);
169 * Schema path in schema tree from actual concrete type to the root.
171 * @param schemaPath schema path in schema tree
173 void setSchemaPath(SchemaPath schemaPath);
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
180 * @param reference a textual cross-reference to an external document.
182 void setReference(String reference);
185 * Set the YANG source definition.
187 * @param definition YANG source definition, must not be null
189 void setYangSourceDefinition(@NonNull YangSourceDefinition definition);