View Javadoc
1   /*
2    *    Copyright 2006-2023 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.Collection;
20  import java.util.List;
21  
22  public class InitializationBlock {
23  
24      private boolean isStatic;
25      private final List<String> bodyLines = new ArrayList<>();
26      private final List<String> javaDocLines = new ArrayList<>();
27  
28      public InitializationBlock() {
29          this(false);
30      }
31  
32      public InitializationBlock(boolean isStatic) {
33          this.isStatic = isStatic;
34      }
35  
36      public boolean isStatic() {
37          return isStatic;
38      }
39  
40      public void setStatic(boolean isStatic) {
41          this.isStatic = isStatic;
42      }
43  
44      public List<String> getBodyLines() {
45          return bodyLines;
46      }
47  
48      public void addBodyLine(String line) {
49          bodyLines.add(line);
50      }
51  
52      public void addBodyLine(int index, String line) {
53          bodyLines.add(index, line);
54      }
55  
56      public void addBodyLines(Collection<String> lines) {
57          bodyLines.addAll(lines);
58      }
59  
60      public void addBodyLines(int index, Collection<String> lines) {
61          bodyLines.addAll(index, lines);
62      }
63  
64      public List<String> getJavaDocLines() {
65          return javaDocLines;
66      }
67  
68      public void addJavaDocLine(String javaDocLine) {
69          javaDocLines.add(javaDocLine);
70      }
71  }