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.yangtools.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.yangtools.binding.model.api.Constant;
14 import org.opendaylight.yangtools.binding.model.api.Enumeration;
15 import org.opendaylight.yangtools.binding.model.api.GeneratedTransferObject;
16 import org.opendaylight.yangtools.binding.model.api.Type;
17 import org.opendaylight.yangtools.binding.model.api.TypeComment;
18 import org.opendaylight.yangtools.binding.model.api.YangSourceDefinition;
20 public interface GeneratedTypeBuilderBase<T extends GeneratedTypeBuilderBase<T>> extends Type, AnnotableTypeBuilder {
22 * Adds new Enclosing Transfer Object <code>genTOBuilder</code> into definition of Generated Type.
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}.
32 * @param genTO Name of Enclosing Type
34 T addEnclosingTransferObject(GeneratedTransferObject genTO);
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
41 * @param comment Comment String.
43 T addComment(TypeComment comment);
48 * Sets the <code>abstract</code> flag to define Generated Type as <i>abstract</i> type.
50 * @param isAbstract abstract flag
52 T setAbstract(boolean isAbstract);
54 List<Type> getImplementsTypes();
57 * Add Type to implements.
59 * @param genType Type to implement
60 * @return <code>true</code> if the addition of type is successful.
62 T addImplementsType(Type genType);
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.
70 * @param type Constant Type
71 * @param name Name of Constant
72 * @param value Assigned Value
73 * @return <code>new</code> Constant instance.
75 Constant addConstant(Type type, String name, Object value);
78 * Adds new Enumeration definition for Generated Type Builder and returns Enum Builder for specifying all Enum
80 * If there is already Enumeration stored with the same name, the old enum will be simply overwritten byt new enum
82 * Name of Enumeration cannot be <code>null</code>, if it is <code>null</code> the method SHOULD throw
83 * {@link IllegalArgumentException}.
85 * @param enumeration Enumeration to add
87 void addEnumeration(Enumeration enumeration);
89 List<MethodSignatureBuilder> getMethodDefinitions();
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)}
100 * @param name Name of Method
101 * @return <code>new</code> instance of Method Signature Builder.
103 MethodSignatureBuilder addMethod(String name);
106 * Checks if GeneratedTypeBuilder contains method with name <code>methodName</code>.
108 * @param methodName is method name
110 boolean containsMethod(String methodName);
112 List<GeneratedPropertyBuilder> getProperties();
115 * Returns the YANG definition of this type, if available.
117 * @return YANG source definition, or empty when unavailable.
119 Optional<YangSourceDefinition> getYangSourceDefinition();
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}.
127 * @param name Name of Property
128 * @return <code>new</code> instance of Generated Property Builder.
130 GeneratedPropertyBuilder addProperty(String name);
133 * Check whether GeneratedTOBuilder contains property with name <code>name</code>.
135 * @param name of property which existence is checked
136 * @return true if property <code>name</code> exists in list of properties.
138 boolean containsProperty(String name);
141 * Set a string that contains a human-readable textual description of type definition.
143 * @param description a string that contains a human-readable textual description of type definition.
145 void setDescription(String description);
148 * Set the name of the module, in which generated type was specified.
150 * @param moduleName the name of the module
152 void setModuleName(String moduleName);
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
159 * @param reference a textual cross-reference to an external document.
161 void setReference(String reference);
164 * Set the YANG source definition.
166 * @param definition YANG source definition, must not be null
168 void setYangSourceDefinition(@NonNull YangSourceDefinition definition);