Merge "OF plugin classes must have a strict dependency on Connection Service"
[controller.git] / opendaylight / sal / yang-prototype / code-generator / binding-model-api / src / main / java / org / opendaylight / controller / sal / binding / model / api / type / builder / MethodSignatureBuilder.java
1 /**
2
3  *
4  * March 2013
5  *
6  * Copyright (c) 2013 by Cisco Systems, Inc.
7  * All rights reserved.
8  */
9 package org.opendaylight.controller.sal.binding.model.api.type.builder;
10
11 import org.opendaylight.controller.sal.binding.model.api.MethodSignature;
12 import org.opendaylight.controller.sal.binding.model.api.Type;
13
14 /**
15  * Method Signature Builder serves solely for building Method Signature and
16  * returning the <code>new</code> instance of Method Signature.
17  * <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
20  * be 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.
23  * <br>
24  * The methods as {@link #addAnnotation(String, String)} and {@link #setComment(String)}
25  * can be used as optional because not all methods MUST contain annotation or
26  * comment definitions.
27  *
28  *
29  * @see MethodSignature
30  */
31 public interface MethodSignatureBuilder extends TypeMemberBuilder {
32
33     /**
34      * Sets the flag for declaration of method as abstract or non abstract. If the flag <code>isAbstract == true</code>
35      * The instantiated Method Signature MUST have return value for {@link org.opendaylight.controller.sal.binding
36      * .model.api.MethodSignature#isAbstract()} also equals to <code>true</code>.
37      *
38      * @param isAbstract is abstract flag
39      */
40     public void setAbstract(boolean isAbstract);
41
42     /**
43      * Adds Parameter into the List of method parameters. Neither the Name or
44      * Type of parameter can be <code>null</code>.
45      *
46      * <br>
47      * In case that any of parameters are defined as <code>null</code> the
48      * method SHOULD throw an {@link IllegalArgumentException}
49      *
50      * @param type Parameter Type
51      * @param name Parameter Name
52      */
53     public void addParameter(final Type type, final String name);
54
55     /**
56      * Returns <code>new</code> <i>immutable</i> instance of Method Signature.
57      * <br>
58      * The <code>definingType</code> param cannot be <code>null</code>. The
59      * every method in Java MUST be declared and defined inside the scope of
60      * <code>class</code> or <code>interface</code> definition. In case that
61      * defining Type will be passed as <code>null</code> reference the method
62      * SHOULD thrown {@link IllegalArgumentException}.
63      *
64      * @param definingType Defining Type of Method Signature
65      * @return <code>new</code> <i>immutable</i> instance of Method Signature.
66      */
67     public MethodSignature toInstance(final Type definingType);
68 }