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
19
20
21
22 public class PrimitiveTypeWrapper extends FullyQualifiedJavaType {
23 private static PrimitiveTypeWrapper booleanInstance;
24 private static PrimitiveTypeWrapper byteInstance;
25 private static PrimitiveTypeWrapper characterInstance;
26 private static PrimitiveTypeWrapper doubleInstance;
27 private static PrimitiveTypeWrapper floatInstance;
28 private static PrimitiveTypeWrapper integerInstance;
29 private static PrimitiveTypeWrapper longInstance;
30 private static PrimitiveTypeWrapper shortInstance;
31
32 private String toPrimitiveMethod;
33
34
35
36
37
38
39
40
41
42
43 private PrimitiveTypeWrapper(String fullyQualifiedName,
44 String toPrimitiveMethod) {
45 super(fullyQualifiedName);
46 this.toPrimitiveMethod = toPrimitiveMethod;
47 }
48
49 public String getToPrimitiveMethod() {
50 return toPrimitiveMethod;
51 }
52
53 public static PrimitiveTypeWrapper getBooleanInstance() {
54 if (booleanInstance == null) {
55 booleanInstance = new PrimitiveTypeWrapper("java.lang.Boolean",
56 "booleanValue()");
57 }
58
59 return booleanInstance;
60 }
61
62 public static PrimitiveTypeWrapper getByteInstance() {
63 if (byteInstance == null) {
64 byteInstance = new PrimitiveTypeWrapper("java.lang.Byte",
65 "byteValue()");
66 }
67
68 return byteInstance;
69 }
70
71 public static PrimitiveTypeWrapper getCharacterInstance() {
72 if (characterInstance == null) {
73 characterInstance = new PrimitiveTypeWrapper("java.lang.Character",
74 "charValue()");
75 }
76
77 return characterInstance;
78 }
79
80 public static PrimitiveTypeWrapper getDoubleInstance() {
81 if (doubleInstance == null) {
82 doubleInstance = new PrimitiveTypeWrapper("java.lang.Double",
83 "doubleValue()");
84 }
85
86 return doubleInstance;
87 }
88
89 public static PrimitiveTypeWrapper getFloatInstance() {
90 if (floatInstance == null) {
91 floatInstance = new PrimitiveTypeWrapper("java.lang.Float",
92 "floatValue()");
93 }
94
95 return floatInstance;
96 }
97
98 public static PrimitiveTypeWrapper getIntegerInstance() {
99 if (integerInstance == null) {
100 integerInstance = new PrimitiveTypeWrapper("java.lang.Integer",
101 "intValue()");
102 }
103
104 return integerInstance;
105 }
106
107 public static PrimitiveTypeWrapper getLongInstance() {
108 if (longInstance == null) {
109 longInstance = new PrimitiveTypeWrapper("java.lang.Long",
110 "longValue()");
111 }
112
113 return longInstance;
114 }
115
116 public static PrimitiveTypeWrapper getShortInstance() {
117 if (shortInstance == null) {
118 shortInstance = new PrimitiveTypeWrapper("java.lang.Short",
119 "shortValue()");
120 }
121
122 return shortInstance;
123 }
124 }