Introduce top-level pom file.
[mdsal.git] / binding / mdsal-binding-generator-api / src / main / java / org / opendaylight / yangtools / sal / 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.yangtools.sal.binding.model.api.type.builder;
9
10 import org.opendaylight.yangtools.sal.binding.model.api.MethodSignature;
11 import org.opendaylight.yangtools.sal.binding.model.api.Type;
12
13 /**
14  * Method Signature Builder serves solely for building Method Signature and
15  * returning the <code>new</code> instance of Method Signature. <br>
16  * By definition of {@link MethodSignature} the Method in java MUST contain
17  * Name, Return Type and Access Modifier. By default the Access Modifier can be
18  * set to public. The Method Signature builder does not contain method for
19  * addName due to enforce reason that MethodSignatureBuilder SHOULD be
20  * instantiated only once with defined method name. <br>
21  * The methods as {@link #addAnnotation(String, String)} and
22  * {@link #setComment(String)} can be used as optional because not all methods
23  * MUST contain annotation or comment definitions.
24  *
25  *
26  * @see MethodSignature
27  */
28 public interface MethodSignatureBuilder extends TypeMemberBuilder<MethodSignatureBuilder> {
29
30     /**
31      * Sets the flag for declaration of method as abstract or non abstract. If
32      * the flag <code>isAbstract == true</code> The instantiated Method
33      * Signature MUST have return value for {@link MethodSignature#isAbstract()}
34      * also equals to <code>true</code>.
35      *
36      * @param isAbstract
37      *            is abstract flag
38      */
39     MethodSignatureBuilder setAbstract(boolean isAbstract);
40
41     /**
42      * Adds Parameter into the List of method parameters. Neither the Name or
43      * Type of parameter can be <code>null</code>.
44      *
45      * <br>
46      * In case that any of parameters are defined as <code>null</code> the
47      * method SHOULD throw an {@link IllegalArgumentException}
48      *
49      * @param type
50      *            Parameter Type
51      * @param name
52      *            Parameter Name
53      */
54     MethodSignatureBuilder addParameter(final Type type, final String name);
55
56     /**
57      * Returns <code>new</code> <i>immutable</i> instance of Method Signature. <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
65      *            Defining Type of Method Signature
66      * @return <code>new</code> <i>immutable</i> instance of Method Signature.
67      */
68     MethodSignature toInstance(final Type definingType);
69 }