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.Enumeration;
15 import org.opendaylight.mdsal.binding.model.api.GeneratedTransferObject;
16 import org.opendaylight.mdsal.binding.model.api.Type;
17 import org.opendaylight.mdsal.binding.model.api.TypeComment;
18 import org.opendaylight.mdsal.binding.model.api.YangSourceDefinition;
19 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
21 public interface GeneratedTypeBuilderBase<T extends GeneratedTypeBuilderBase<T>> extends Type, AnnotableTypeBuilder {
23 * Adds new Enclosing Transfer Object <code>genTOBuilder</code> into definition of Generated Type.
26 * There is no need of specifying of Package Name because enclosing Type is already defined inside Generated Type
27 * with specific package name.<br>
28 * The name of enclosing Type cannot be same as Name of parent type and if there is already defined enclosing type
29 * with the same name, the new enclosing type will simply overwrite the older definition.<br>
30 * If the parameter <code>genTOBuilder</code> of enclosing type is <code>null</code> the method SHOULD throw
31 * {@link IllegalArgumentException}.
33 * @param genTO Name of Enclosing Type
35 T addEnclosingTransferObject(GeneratedTransferObject genTO);
38 * Adds String definition of comment into Method Signature definition.<br>
39 * The comment String MUST NOT contain any comment specific chars (i.e. "/**" or "//") just plain String text
42 * @param comment Comment String.
44 T addComment(TypeComment comment);
49 * Sets the <code>abstract</code> flag to define Generated Type as <i>abstract</i> type.
51 * @param isAbstract abstract flag
53 T setAbstract(boolean isAbstract);
55 List<Type> getImplementsTypes();
58 * Add Type to implements.
60 * @param genType Type to implement
61 * @return <code>true</code> if the addition of type is successful.
63 T addImplementsType(Type genType);
66 * Adds Constant definition and returns <code>new</code> Constant instance.<br>
67 * By definition Constant MUST be defined by return Type, Name and assigned value. The name SHOULD be defined
68 * with capital letters. Neither of method parameters can be <code>null</code> and the method SHOULD throw
69 * {@link IllegalArgumentException} if the contract is broken.
71 * @param type Constant Type
72 * @param name Name of Constant
73 * @param value Assigned Value
74 * @return <code>new</code> Constant instance.
76 Constant addConstant(Type type, String name, Object value);
79 * Adds new Enumeration definition for Generated Type Builder and returns Enum Builder for specifying all Enum
81 * If there is already Enumeration stored with the same name, the old enum will be simply overwritten byt new enum
83 * Name of Enumeration cannot be <code>null</code>, if it is <code>null</code> the method SHOULD throw
84 * {@link IllegalArgumentException}.
86 * @param enumeration Enumeration to add
88 void addEnumeration(Enumeration enumeration);
90 List<MethodSignatureBuilder> getMethodDefinitions();
93 * Add new Method Signature definition for Generated Type Builder and returns Method Signature Builder
94 * for specifying all Method parameters.<br>
95 * Name of Method cannot be <code>null</code>, if it is <code>null</code> the method SHOULD throw
96 * {@link IllegalArgumentException}.<br>
97 * By <i>Default</i> the MethodSignatureBuilder SHOULD be pre-set as
98 * {@link MethodSignatureBuilder#setAbstract(boolean)}, {TypeMemberBuilder#setFinal(boolean)} and
99 * {TypeMemberBuilder#setAccessModifier(boolean)}
101 * @param name Name of Method
102 * @return <code>new</code> instance of Method Signature Builder.
104 MethodSignatureBuilder addMethod(String name);
107 * Checks if GeneratedTypeBuilder contains method with name <code>methodName</code>.
109 * @param methodName is method name
111 boolean containsMethod(String methodName);
113 List<GeneratedPropertyBuilder> getProperties();
116 * Returns the YANG definition of this type, if available.
118 * @return YANG source definition, or empty when unavailable.
120 Optional<YangSourceDefinition> getYangSourceDefinition();
123 * Add new Generated Property definition for Generated Transfer Object Builder and returns Generated Property
124 * Builder for specifying Property.<br>
125 * Name of Property cannot be <code>null</code>, if it is <code>null</code> the method SHOULD throw
126 * {@link IllegalArgumentException}.
128 * @param name Name of Property
129 * @return <code>new</code> instance of Generated Property Builder.
131 GeneratedPropertyBuilder addProperty(String name);
134 * Check whether GeneratedTOBuilder contains property with name <code>name</code>.
136 * @param name of property which existence is checked
137 * @return true if property <code>name</code> exists in list of properties.
139 boolean containsProperty(String name);
142 * Set a string that contains a human-readable textual description of type definition.
144 * @param description a string that contains a human-readable textual description of type definition.
146 void setDescription(String description);
149 * Set the name of the module, in which generated type was specified.
151 * @param moduleName the name of the module
153 void setModuleName(String moduleName);
156 * Schema path in schema tree from actual concrete type to the root.
158 * @param schemaPath schema path in schema tree
160 void setSchemaPath(SchemaPath schemaPath);
163 * Set a string that is used to specify a textual cross-reference to an external document, either another module
164 * that defines related management information, or a document that provides additional information relevant to this
167 * @param reference a textual cross-reference to an external document.
169 void setReference(String reference);
172 * Set the YANG source definition.
174 * @param definition YANG source definition, must not be null
176 void setYangSourceDefinition(@NonNull YangSourceDefinition definition);