Skip to content

Commit e071f53

Browse files
committed
no anon classes
1 parent a8c08f7 commit e071f53

File tree

1 file changed

+23
-14
lines changed
  • http-generator-core/src/main/java/io/avaje/http/generator/core

1 file changed

+23
-14
lines changed

http-generator-core/src/main/java/io/avaje/http/generator/core/TypeMap.java

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,7 @@ static TypeHandler get(String type) {
4444
}
4545

4646
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);
5848
}
5949

6050
static class StringHandler extends JavaLangType {
@@ -183,7 +173,7 @@ static class BoolHandler extends Primitive {
183173
}
184174
}
185175

186-
static abstract class JavaLangType implements TypeHandler {
176+
abstract static class JavaLangType implements TypeHandler {
187177

188178
final String shortName;
189179

@@ -207,7 +197,7 @@ public String importType() {
207197
}
208198
}
209199

210-
static abstract class Primitive implements TypeHandler {
200+
abstract static class Primitive implements TypeHandler {
211201

212202
private final String type;
213203

@@ -291,8 +281,27 @@ static class LocalDateTimeHandler extends ObjectHandler {
291281
}
292282
}
293283

284+
static class EnumHandler extends ObjectHandler {
285+
private final UType type;
294286

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 {
296305

297306
private final String importType;
298307
private final String shortName;

0 commit comments

Comments
 (0)