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