6 * Copyright (c) 2013 by Cisco Systems, Inc.
9 package org.opendaylight.yangtools.sal.binding.model.api.type.builder;
11 import org.opendaylight.yangtools.sal.binding.model.api.MethodSignature;
12 import org.opendaylight.yangtools.sal.binding.model.api.Type;
15 * Method Signature Builder serves solely for building Method Signature and
16 * returning the <code>new</code> instance of Method Signature. <br>
17 * By definition of {@link MethodSignature} the Method in java MUST contain
18 * Name, Return Type and Access Modifier. By default the Access Modifier can be
19 * set to public. The Method Signature builder does not contain method for
20 * addName due to enforce reason that MethodSignatureBuilder SHOULD be
21 * instantiated only once with defined method name. <br>
22 * The methods as {@link #addAnnotation(String, String)} and
23 * {@link #setComment(String)} can be used as optional because not all methods
24 * MUST contain annotation or comment definitions.
27 * @see MethodSignature
29 public interface MethodSignatureBuilder extends TypeMemberBuilder<MethodSignatureBuilder> {
32 * Sets the flag for declaration of method as abstract or non abstract. If
33 * the flag <code>isAbstract == true</code> The instantiated Method
34 * Signature MUST have return value for {@link MethodSignature#isAbstract()}
35 * also equals to <code>true</code>.
40 MethodSignatureBuilder setAbstract(boolean isAbstract);
43 * Adds Parameter into the List of method parameters. Neither the Name or
44 * Type of parameter can be <code>null</code>.
47 * In case that any of parameters are defined as <code>null</code> the
48 * method SHOULD throw an {@link IllegalArgumentException}
55 MethodSignatureBuilder addParameter(final Type type, final String name);
58 * Returns <code>new</code> <i>immutable</i> instance of Method Signature. <br>
59 * The <code>definingType</code> param cannot be <code>null</code>. The
60 * every method in Java MUST be declared and defined inside the scope of
61 * <code>class</code> or <code>interface</code> definition. In case that
62 * defining Type will be passed as <code>null</code> reference the method
63 * SHOULD thrown {@link IllegalArgumentException}.
66 * Defining Type of Method Signature
67 * @return <code>new</code> <i>immutable</i> instance of Method Signature.
69 MethodSignature toInstance(final Type definingType);