1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.mybatis.generator.api.dom.java;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.mybatis.generator.api.dom.java.render.ParameterRenderer;
22
23 public class Parameter {
24 private final String name;
25 private final FullyQualifiedJavaType type;
26 private final boolean isVarargs;
27
28 private final List<String> annotations = new ArrayList<>();
29
30 public Parameter(FullyQualifiedJavaType type, String name, boolean isVarargs) {
31 this.name = name;
32 this.type = type;
33 this.isVarargs = isVarargs;
34 }
35
36 public Parameter(FullyQualifiedJavaType type, String name) {
37 this(type, name, false);
38 }
39
40 public Parameter(FullyQualifiedJavaType type, String name, String annotation) {
41 this(type, name, false);
42 addAnnotation(annotation);
43 }
44
45 public Parameter(FullyQualifiedJavaType type, String name, String annotation, boolean isVarargs) {
46 this(type, name, isVarargs);
47 addAnnotation(annotation);
48 }
49
50 public String getName() {
51 return name;
52 }
53
54 public FullyQualifiedJavaType getType() {
55 return type;
56 }
57
58 public List<String> getAnnotations() {
59 return annotations;
60 }
61
62 public void addAnnotation(String annotation) {
63 annotations.add(annotation);
64 }
65
66 @Override
67 public String toString() {
68 return new ParameterRenderer().render(this, null);
69 }
70
71 public boolean isVarargs() {
72 return isVarargs;
73 }
74 }