Hide binding.model.api.DefaultType
[mdsal.git] / binding / mdsal-binding-model-api / src / main / java / org / opendaylight / mdsal / binding / model / api / type / builder / GeneratedTypeBuilderBase.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.binding.model.api.type.builder;
9
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;
20
21 public interface GeneratedTypeBuilderBase<T extends GeneratedTypeBuilderBase<T>> extends Type, AnnotableTypeBuilder {
22     /**
23      * Adds new Enclosing Transfer Object <code>genTOBuilder</code> into definition of Generated Type.
24      *
25      * <br>
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}.
32      *
33      * @param genTO Name of Enclosing Type
34      */
35     T addEnclosingTransferObject(GeneratedTransferObject genTO);
36
37     /**
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
40      * description.
41      *
42      * @param comment Comment String.
43      */
44     T addComment(TypeComment comment);
45
46     boolean isAbstract();
47
48     /**
49      * Sets the <code>abstract</code> flag to define Generated Type as <i>abstract</i> type.
50      *
51      * @param isAbstract abstract flag
52      */
53     T setAbstract(boolean isAbstract);
54
55     List<Type> getImplementsTypes();
56
57     /**
58      * Add Type to implements.
59      *
60      * @param genType Type to implement
61      * @return <code>true</code> if the addition of type is successful.
62      */
63     T addImplementsType(Type genType);
64
65     /**
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.
70      *
71      * @param type Constant Type
72      * @param name Name of Constant
73      * @param value Assigned Value
74      * @return <code>new</code> Constant instance.
75      */
76     Constant addConstant(Type type, String name, Object value);
77
78     /**
79      * Adds new Enumeration definition for Generated Type Builder and returns Enum Builder for specifying all Enum
80      * parameters.<br>
81      * If there is already Enumeration stored with the same name, the old enum will be simply overwritten byt new enum
82      * definition.<br>
83      * Name of Enumeration cannot be <code>null</code>, if it is <code>null</code> the method SHOULD throw
84      * {@link IllegalArgumentException}.
85      *
86      * @param enumeration Enumeration to add
87      */
88     void addEnumeration(Enumeration enumeration);
89
90     List<MethodSignatureBuilder> getMethodDefinitions();
91
92     /**
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)}
100      *
101      * @param name Name of Method
102      * @return <code>new</code> instance of Method Signature Builder.
103      */
104     MethodSignatureBuilder addMethod(String name);
105
106     /**
107      * Checks if GeneratedTypeBuilder contains method with name <code>methodName</code>.
108      *
109      * @param methodName is method name
110      */
111     boolean containsMethod(String methodName);
112
113     List<GeneratedPropertyBuilder> getProperties();
114
115     /**
116      * Returns the YANG definition of this type, if available.
117      *
118      * @return YANG source definition, or empty when unavailable.
119      */
120     Optional<YangSourceDefinition> getYangSourceDefinition();
121
122     /**
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}.
127      *
128      * @param name Name of Property
129      * @return <code>new</code> instance of Generated Property Builder.
130      */
131     GeneratedPropertyBuilder addProperty(String name);
132
133     /**
134      * Check whether GeneratedTOBuilder contains property with name <code>name</code>.
135      *
136      * @param name of property which existence is checked
137      * @return true if property <code>name</code> exists in list of properties.
138      */
139     boolean containsProperty(String name);
140
141     /**
142      * Set a string that contains a human-readable textual description of type definition.
143      *
144      * @param description a string that contains a human-readable textual description of type definition.
145      */
146     void setDescription(String description);
147
148     /**
149      * Set the name of the module, in which generated type was specified.
150      *
151      * @param moduleName the name of the module
152      */
153     void setModuleName(String moduleName);
154
155     /**
156      * Schema path in schema tree from actual concrete type to the root.
157      *
158      * @param schemaPath schema path in schema tree
159      */
160     void setSchemaPath(SchemaPath schemaPath);
161
162     /**
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
165      * definition.
166      *
167      * @param reference a textual cross-reference to an external document.
168      */
169     void setReference(String reference);
170
171     /**
172      * Set the YANG source definition.
173      *
174      * @param definition YANG source definition, must not be null
175      */
176     void setYangSourceDefinition(@NonNull YangSourceDefinition definition);
177 }