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 /**
22 * This class encapsulates the idea of an inner enum - it has methods that make it easy to generate inner enum.
23 *
24 * @author Jeff Butler
25 */
26 public class InnerEnum extends AbstractJavaType {
27
28 private final List<String> enumConstants = new ArrayList<>();
29
30 private final List<InitializationBlock> initializationBlocks = new ArrayList<>();
31
32 public InnerEnum(FullyQualifiedJavaType type) {
33 super(type);
34 }
35
36 public InnerEnum(String type) {
37 super(type);
38 }
39
40 public List<String> getEnumConstants() {
41 return enumConstants;
42 }
43
44 public void addEnumConstant(String enumConstant) {
45 enumConstants.add(enumConstant);
46 }
47
48 public List<InitializationBlock> getInitializationBlocks() {
49 return initializationBlocks;
50 }
51
52 public void addInitializationBlock(InitializationBlock initializationBlock) {
53 initializationBlocks.add(initializationBlock);
54 }
55 }