Merge "Resolve Bug:445 Remove freemarker from config code generator."
[controller.git] / opendaylight / config / yang-jmx-generator-plugin / src / main / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / ftl / model / MethodDefinition.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.controller.config.yangjmxgenerator.plugin.ftl.model;
9
10 import java.util.Collections;
11 import java.util.List;
12
13 public class MethodDefinition implements Method {
14     private final List<String> modifiers;
15     private final String returnType;
16     private final String name;
17     private final List<Field> parameters;
18     private final List<String> throwsExceptions;
19     private final String body;
20     private String javadoc = null;
21     private final List<Annotation> annotations;
22
23     // TODO remove, Constructor is in separate class
24     public static MethodDefinition createConstructor(String name,
25             List<Field> parameters, String body) {
26         return new MethodDefinition("", name, parameters, body);
27
28     }
29
30     public MethodDefinition(String returnType, String name,
31             List<Field> parameters, String body) {
32         this(Collections.<String> emptyList(), returnType, name, parameters,
33                 Collections.<String> emptyList(), Collections
34                         .<Annotation> emptyList(), body);
35     }
36
37     public MethodDefinition(String returnType, String name,
38             List<Field> parameters, List<Annotation> annotations, String body) {
39         this(Collections.<String> emptyList(), returnType, name, parameters,
40                 Collections.<String> emptyList(), annotations, body);
41     }
42
43     public MethodDefinition(List<String> modifiers, String returnType,
44             String name, List<Field> parameters, List<String> throwsExceptions,
45             List<Annotation> annotations, String body) {
46         this.modifiers = modifiers;
47         this.returnType = returnType;
48         this.name = name;
49         this.parameters = parameters;
50         this.throwsExceptions = throwsExceptions;
51         this.body = body;
52         this.annotations = annotations;
53     }
54
55     @Override
56     public List<Annotation> getAnnotations() {
57         return annotations;
58     }
59
60     @Override
61     public String getJavadoc() {
62         return javadoc;
63     }
64
65     public void setJavadoc(String javadoc) {
66         this.javadoc = javadoc;
67     }
68
69     @Override
70     public String getReturnType() {
71         return returnType;
72     }
73
74     @Override
75     public String getName() {
76         return name;
77     }
78
79     @Override
80     public List<Field> getParameters() {
81         return parameters;
82     }
83
84     public List<String> getThrowsExceptions() {
85         return throwsExceptions;
86     }
87
88     public String getBody() {
89         return body;
90     }
91
92     @Override
93     public List<String> getModifiers() {
94         return modifiers;
95     }
96
97     @Override
98     public String toString() {
99         return MethodSerializer.toString(this);
100     }
101 }