Bug 1411: MDSAL Binding2 Generator API Enumeration fix
[mdsal.git] / binding2 / mdsal-binding2-generator-api / src / main / java / org / opendaylight / mdsal / binding2 / model / api / type / builder / MethodSignatureBuilder.java
1 /*
2  * Copyright (c) 2016 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
9 package org.opendaylight.mdsal.binding2.model.api.type.builder;
10
11 import com.google.common.annotations.Beta;
12 import org.opendaylight.mdsal.binding2.model.api.MethodSignature;
13 import org.opendaylight.mdsal.binding2.model.api.Type;
14
15 /**
16  * Method Signature Builder serves solely for building Method Signature and
17  * returning the <code>new</code> instance of Method Signature. <br>
18  * By definition of {@link MethodSignature} the Method in java MUST contain
19  * Name, Return Type and Access Modifier. By default the Access Modifier can be
20  * set to public. The Method Signature builder does not contain method for
21  * addName due to enforce reason that MethodSignatureBuilder SHOULD be
22  * instantiated only once with defined method name. <br>
23  * The methods as {@link #addAnnotation(String, String)} and
24  * {@link #setComment(String)} can be used as optional because not all methods
25  * MUST contain annotation or comment definitions.
26  *
27  *
28  * @see MethodSignature
29  */
30 @Beta
31 public interface MethodSignatureBuilder extends TypeMemberBuilder<MethodSignatureBuilder> {
32
33     /**
34      * Sets the flag for declaration of method as abstract or non abstract. If
35      * the flag <code>isAbstract == true</code> The instantiated Method
36      * Signature MUST have return value for {@link MethodSignature#isAbstract()}
37      * also equals to <code>true</code>.
38      *
39      * @param isAbstract
40      *            is abstract flag
41      */
42     MethodSignatureBuilder setAbstract(boolean isAbstract);
43
44     /**
45      * Adds Parameter into the List of method parameters. Neither the Name or
46      * Type of parameter can be <code>null</code>.
47      *
48      * <br>
49      * In case that any of parameters are defined as <code>null</code> the
50      * method SHOULD throw an {@link IllegalArgumentException}
51      *
52      * @param type
53      *            Parameter Type
54      * @param name
55      *            Parameter Name
56      */
57     MethodSignatureBuilder addParameter(final Type type, final String name);
58
59     /**
60      * Returns <code>new</code> <i>immutable</i> instance of Method Signature. <br>
61      * The <code>definingType</code> param cannot be <code>null</code>. The
62      * every method in Java MUST be declared and defined inside the scope of
63      * <code>class</code> or <code>interface</code> definition. In case that
64      * defining Type will be passed as <code>null</code> reference the method
65      * SHOULD thrown {@link IllegalArgumentException}.
66      *
67      * @param definingType
68      *            Defining Type of Method Signature
69      * @return <code>new</code> <i>immutable</i> instance of Method Signature.
70      */
71     MethodSignature toInstance(final Type definingType);
72 }