View Javadoc
1   /*
2    *    Copyright 2006-2026 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       https://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package org.mybatis.generator.api.dom.java;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  public class Parameter {
22      private final String name;
23      private final FullyQualifiedJavaType type;
24      private final boolean isVarargs;
25  
26      private final List<String> annotations = new ArrayList<>();
27  
28      public Parameter(FullyQualifiedJavaType type, String name, boolean isVarargs) {
29          this.name = name;
30          this.type = type;
31          this.isVarargs = isVarargs;
32      }
33  
34      public Parameter(FullyQualifiedJavaType type, String name) {
35          this(type, name, false);
36      }
37  
38      public Parameter(FullyQualifiedJavaType type, String name, String annotation) {
39          this(type, name, false);
40          addAnnotation(annotation);
41      }
42  
43      public Parameter(FullyQualifiedJavaType type, String name, String annotation, boolean isVarargs) {
44          this(type, name, isVarargs);
45          addAnnotation(annotation);
46      }
47  
48      public String getName() {
49          return name;
50      }
51  
52      public FullyQualifiedJavaType getType() {
53          return type;
54      }
55  
56      public List<String> getAnnotations() {
57          return annotations;
58      }
59  
60      public void addAnnotation(String annotation) {
61          annotations.add(annotation);
62      }
63  
64      public boolean isVarargs() {
65          return isVarargs;
66      }
67  }