Pick up byte-buddy from yangtools
[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
20 public interface GeneratedTypeBuilderBase<T extends GeneratedTypeBuilderBase<T>> extends Type, AnnotableTypeBuilder {
21     /**
22      * Adds new Enclosing Transfer Object <code>genTOBuilder</code> into definition of Generated Type.
23      *
24      * <br>
25      * There is no need of specifying of Package Name because enclosing Type is already defined inside Generated Type
26      * with specific package name.<br>
27      * The name of enclosing Type cannot be same as Name of parent type and if there is already defined enclosing type
28      * with the same name, the new enclosing type will simply overwrite the older definition.<br>
29      * If the parameter <code>genTOBuilder</code> of enclosing type is <code>null</code> the method SHOULD throw
30      * {@link IllegalArgumentException}.
31      *
32      * @param genTO Name of Enclosing Type
33      */
34     T addEnclosingTransferObject(GeneratedTransferObject genTO);
35
36     /**
37      * Adds String definition of comment into Method Signature definition.<br>
38      * The comment String MUST NOT contain any comment specific chars (i.e. "/**" or "//") just plain String text
39      * description.
40      *
41      * @param comment Comment String.
42      */
43     T addComment(TypeComment comment);
44
45     boolean isAbstract();
46
47     /**
48      * Sets the <code>abstract</code> flag to define Generated Type as <i>abstract</i> type.
49      *
50      * @param isAbstract abstract flag
51      */
52     T setAbstract(boolean isAbstract);
53
54     List<Type> getImplementsTypes();
55
56     /**
57      * Add Type to implements.
58      *
59      * @param genType Type to implement
60      * @return <code>true</code> if the addition of type is successful.
61      */
62     T addImplementsType(Type genType);
63
64     /**
65      * Adds Constant definition and returns <code>new</code> Constant instance.<br>
66      * By definition Constant MUST be defined by return Type, Name and assigned value. The name SHOULD be defined
67      * with capital letters. Neither of method parameters can be <code>null</code> and the method SHOULD throw
68      * {@link IllegalArgumentException} if the contract is broken.
69      *
70      * @param type Constant Type
71      * @param name Name of Constant
72      * @param value Assigned Value
73      * @return <code>new</code> Constant instance.
74      */
75     Constant addConstant(Type type, String name, Object value);
76
77     /**
78      * Adds new Enumeration definition for Generated Type Builder and returns Enum Builder for specifying all Enum
79      * parameters.<br>
80      * If there is already Enumeration stored with the same name, the old enum will be simply overwritten byt new enum
81      * definition.<br>
82      * Name of Enumeration cannot be <code>null</code>, if it is <code>null</code> the method SHOULD throw
83      * {@link IllegalArgumentException}.
84      *
85      * @param enumeration Enumeration to add
86      */
87     void addEnumeration(Enumeration enumeration);
88
89     List<MethodSignatureBuilder> getMethodDefinitions();
90
91     /**
92      * Add new Method Signature definition for Generated Type Builder and returns Method Signature Builder
93      * for specifying all Method parameters.<br>
94      * Name of Method cannot be <code>null</code>, if it is <code>null</code> the method SHOULD throw
95      * {@link IllegalArgumentException}.<br>
96      * By <i>Default</i> the MethodSignatureBuilder SHOULD be pre-set as
97      * {@link MethodSignatureBuilder#setAbstract(boolean)}, {TypeMemberBuilder#setFinal(boolean)} and
98      * {TypeMemberBuilder#setAccessModifier(boolean)}
99      *
100      * @param name Name of Method
101      * @return <code>new</code> instance of Method Signature Builder.
102      */
103     MethodSignatureBuilder addMethod(String name);
104
105     /**
106      * Checks if GeneratedTypeBuilder contains method with name <code>methodName</code>.
107      *
108      * @param methodName is method name
109      */
110     boolean containsMethod(String methodName);
111
112     List<GeneratedPropertyBuilder> getProperties();
113
114     /**
115      * Returns the YANG definition of this type, if available.
116      *
117      * @return YANG source definition, or empty when unavailable.
118      */
119     Optional<YangSourceDefinition> getYangSourceDefinition();
120
121     /**
122      * Add new Generated Property definition for Generated Transfer Object Builder and returns Generated Property
123      * Builder for specifying Property.<br>
124      * Name of Property cannot be <code>null</code>, if it is <code>null</code> the method SHOULD throw
125      * {@link IllegalArgumentException}.
126      *
127      * @param name Name of Property
128      * @return <code>new</code> instance of Generated Property Builder.
129      */
130     GeneratedPropertyBuilder addProperty(String name);
131
132     /**
133      * Check whether GeneratedTOBuilder contains property with name <code>name</code>.
134      *
135      * @param name of property which existence is checked
136      * @return true if property <code>name</code> exists in list of properties.
137      */
138     boolean containsProperty(String name);
139
140     /**
141      * Set a string that contains a human-readable textual description of type definition.
142      *
143      * @param description a string that contains a human-readable textual description of type definition.
144      */
145     void setDescription(String description);
146
147     /**
148      * Set the name of the module, in which generated type was specified.
149      *
150      * @param moduleName the name of the module
151      */
152     void setModuleName(String moduleName);
153
154     /**
155      * Set a string that is used to specify a textual cross-reference to an external document, either another module
156      * that defines related management information, or a document that provides additional information relevant to this
157      * definition.
158      *
159      * @param reference a textual cross-reference to an external document.
160      */
161     void setReference(String reference);
162
163     /**
164      * Set the YANG source definition.
165      *
166      * @param definition YANG source definition, must not be null
167      */
168     void setYangSourceDefinition(@NonNull YangSourceDefinition definition);
169 }