2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.yangtools.sal.binding.model.api.type.builder;
\r
10 import org.opendaylight.yangtools.sal.binding.model.api.Constant;
\r
11 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedType;
\r
12 import org.opendaylight.yangtools.sal.binding.model.api.Type;
\r
15 * Generated Type Builder interface is helper interface for building and
\r
16 * defining the GeneratedType.
\r
18 * @see GeneratedType
\r
20 public interface GeneratedTypeBuilder extends Type {
\r
23 * Adds new Enclosing Type into definition of Generated Type and returns
\r
24 * <code>new</code> Instance of Generated Type Builder. <br>
\r
25 * There is no need of specifying of Package Name because enclosing Type is
\r
26 * already defined inside Generated Type with specific package name. <br>
\r
27 * The name of enclosing Type cannot be same as Name of parent type and if
\r
28 * there is already defined enclosing type with the same name, the new
\r
29 * enclosing type will simply overwrite the older definition. <br>
\r
30 * If the name of enclosing type is <code>null</code> the method SHOULD
\r
31 * throw {@link IllegalArgumentException}
\r
34 * Name of Enclosing Type
\r
35 * @return <code>new</code> Instance of Generated Type Builder.
\r
37 public GeneratedTypeBuilder addEnclosingType(final String name);
\r
40 * Adds new Enclosing Transfer Object into definition of Generated Type and
\r
41 * returns <code>new</code> Instance of Generated TO Builder. <br>
\r
42 * There is no need of specifying of Package Name because enclosing Type is
\r
43 * already defined inside Generated Type with specific package name. <br>
\r
44 * The name of enclosing Type cannot be same as Name of parent type and if
\r
45 * there is already defined enclosing type with the same name, the new
\r
46 * enclosing type will simply overwrite the older definition. <br>
\r
47 * If the name of enclosing type is <code>null</code> the method SHOULD
\r
48 * throw {@link IllegalArgumentException}
\r
51 * Name of Enclosing Type
\r
52 * @return <code>new</code> Instance of Generated Type Builder.
\r
54 public GeneratedTOBuilder addEnclosingTransferObject(final String name);
\r
57 * Adds new Enclosing Transfer Object <code>genTOBuilder</code> into
\r
58 * definition of Generated Type
\r
61 * There is no need of specifying of Package Name because enclosing Type is
\r
62 * already defined inside Generated Type with specific package name. <br>
\r
63 * The name of enclosing Type cannot be same as Name of parent type and if
\r
64 * there is already defined enclosing type with the same name, the new
\r
65 * enclosing type will simply overwrite the older definition. <br>
\r
66 * If the parameter <code>genTOBuilder</code> of enclosing type is
\r
67 * <code>null</code> the method SHOULD throw
\r
68 * {@link IllegalArgumentException}
\r
70 * @param <code>genTOBuilder</code> Name of Enclosing Type
\r
72 public void addEnclosingTransferObject(final GeneratedTOBuilder genTOBuilder);
\r
75 * Adds String definition of comment into Method Signature definition. <br>
\r
76 * The comment String MUST NOT contain anny comment specific chars (i.e.
\r
77 * "/**" or "//") just plain String text description.
\r
82 public void addComment(final String comment);
\r
85 * The method creates new AnnotationTypeBuilder containing specified package
\r
86 * name an annotation name. <br>
\r
87 * Neither the package name or annotation name can contain <code>null</code>
\r
88 * references. In case that any of parameters contains <code>null</code> the
\r
89 * method SHOULD thrown {@link IllegalArgumentException}
\r
91 * @param packageName
\r
92 * Package Name of Annotation Type
\r
94 * Name of Annotation Type
\r
95 * @return <code>new</code> instance of Annotation Type Builder.
\r
97 public AnnotationTypeBuilder addAnnotation(final String packageName, final String name);
\r
100 * Sets the <code>abstract</code> flag to define Generated Type as
\r
101 * <i>abstract</i> type.
\r
103 * @param isAbstract
\r
106 public void setAbstract(boolean isAbstract);
\r
109 * Add Type to implements.
\r
112 * Type to implement
\r
113 * @return <code>true</code> if the addition of type is successful.
\r
115 public boolean addImplementsType(final Type genType);
\r
118 * Adds Constant definition and returns <code>new</code> Constant instance. <br>
\r
119 * By definition Constant MUST be defined by return Type, Name and assigned
\r
120 * value. The name SHOULD be defined with cpaital letters. Neither of method
\r
121 * parameters can be <code>null</code> and the method SHOULD throw
\r
122 * {@link IllegalArgumentException} if the contract is broken.
\r
130 * @return <code>new</code> Constant instance.
\r
132 public Constant addConstant(final Type type, final String name, final Object value);
\r
135 * Adds new Enumeration definition for Generated Type Builder and returns
\r
136 * Enum Builder for specifying all Enum parameters. <br>
\r
137 * If there is already Enumeration stored with the same name, the old enum
\r
138 * will be simply overwritten byt new enum definition. <br>
\r
139 * Name of Enumeration cannot be <code>null</code>, if it is
\r
140 * <code>null</code> the method SHOULD throw
\r
141 * {@link IllegalArgumentException}
\r
145 * @return <code>new</code> instance of Enumeration Builder.
\r
147 public EnumBuilder addEnumeration(final String name);
\r
150 * Add new Method Signature definition for Generated Type Builder and
\r
151 * returns Method Signature Builder for specifying all Method parameters. <br>
\r
152 * Name of Method cannot be <code>null</code>, if it is <code>null</code>
\r
153 * the method SHOULD throw {@link IllegalArgumentException} <br>
\r
154 * By <i>Default</i> the MethodSignatureBuilder SHOULD be pre-set as
\r
155 * {@link MethodSignatureBuilder#setAbstract(true)},
\r
156 * {@link MethodSignatureBuilder#setFinal(false)} and
\r
157 * {@link MethodSignatureBuilder#setAccessModifier(PUBLIC)}
\r
161 * @return <code>new</code> instance of Method Signature Builder.
\r
163 public MethodSignatureBuilder addMethod(final String name);
\r
166 * Checks if GeneratedTypeBuilder contains method with name
\r
167 * <code>methodName</code>
\r
169 * @param methodName
\r
172 public boolean containsMethod(final String methodName);
\r
175 * Add new Generated Property definition for Generated Transfer Object
\r
176 * Builder and returns Generated Property Builder for specifying Property. <br>
\r
177 * Name of Property cannot be <code>null</code>, if it is <code>null</code>
\r
178 * the method SHOULD throw {@link IllegalArgumentException}
\r
182 * @return <code>new</code> instance of Generated Property Builder.
\r
184 public GeneratedPropertyBuilder addProperty(final String name);
\r
187 * Check whether GeneratedTOBuilder contains property with name
\r
188 * <code>name</code>
\r
191 * of property which existance is checked
\r
192 * @return true if property <code>name</code> exists in list of properties.
\r
194 public boolean containsProperty(final String name);
\r
197 * Returns the <code>new</code> <i>immutable</i> instance of Generated Type.
\r
199 * @return the <code>new</code> <i>immutable</i> instance of Generated Type.
\r
201 public GeneratedType toInstance();
\r