1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.mybatis.generator.config;
17
18 import static org.mybatis.generator.internal.util.messages.Messages.getString;
19
20
21
22
23
24
25 public enum ModelType {
26 HIERARCHICAL("hierarchical"),
27 FLAT("flat"),
28 CONDITIONAL("conditional");
29
30 private final String type;
31
32 ModelType(String type) {
33 this.type = type;
34 }
35
36 public static ModelType getModelType(String type) {
37 if (HIERARCHICAL.type.equalsIgnoreCase(type)) {
38 return HIERARCHICAL;
39 } else if (FLAT.type.equalsIgnoreCase(type)) {
40 return FLAT;
41 } else if (CONDITIONAL.type.equalsIgnoreCase(type)) {
42 return CONDITIONAL;
43 } else {
44 throw new RuntimeException(getString("RuntimeError.13", type));
45 }
46 }
47 }