@@ -44,17 +44,7 @@ static TypeHandler get(String type) {
44
44
}
45
45
46
46
static TypeHandler enumParamHandler (UType type ) {
47
- return new ObjectHandler (type .mainType (), type .shortName ()) {
48
- @ Override
49
- public String toMethod () {
50
- return type .shortType () + ".valueOf(" ;
51
- }
52
-
53
- @ Override
54
- public String asMethod () {
55
- return "java.util. Objects.toString(" ;
56
- }
57
- };
47
+ return new EnumHandler (type );
58
48
}
59
49
60
50
static class StringHandler extends JavaLangType {
@@ -183,7 +173,7 @@ static class BoolHandler extends Primitive {
183
173
}
184
174
}
185
175
186
- static abstract class JavaLangType implements TypeHandler {
176
+ abstract static class JavaLangType implements TypeHandler {
187
177
188
178
final String shortName ;
189
179
@@ -207,7 +197,7 @@ public String importType() {
207
197
}
208
198
}
209
199
210
- static abstract class Primitive implements TypeHandler {
200
+ abstract static class Primitive implements TypeHandler {
211
201
212
202
private final String type ;
213
203
@@ -291,8 +281,27 @@ static class LocalDateTimeHandler extends ObjectHandler {
291
281
}
292
282
}
293
283
284
+ static class EnumHandler extends ObjectHandler {
285
+ private final UType type ;
294
286
295
- static abstract class ObjectHandler implements TypeHandler {
287
+ EnumHandler (UType type ) {
288
+
289
+ super (type .mainType (), type .shortName ());
290
+ this .type = type ;
291
+ }
292
+
293
+ @ Override
294
+ public String toMethod () {
295
+ return type .shortType () + ".valueOf(" ;
296
+ }
297
+
298
+ @ Override
299
+ public String asMethod () {
300
+ return "java.util.Objects.toString(" ;
301
+ }
302
+ }
303
+
304
+ abstract static class ObjectHandler implements TypeHandler {
296
305
297
306
private final String importType ;
298
307
private final String shortName ;
0 commit comments