Skip to content

Commit e56e050

Browse files
committed
Update ElementReader.java
1 parent 2875ce6 commit e56e050

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,20 @@ public class ElementReader {
7575
useValidation = false;
7676
}
7777
if (ParamType.FORM == paramType || ParamType.BEANPARAM == paramType) {
78-
this.imports.addAll(
79-
new BeanParamReader(typeElement(rawType), varName, shortType, paramType).imports());
78+
beanParamImports(rawType);
8079
}
8180
}
8281

82+
private void beanParamImports(String rawType) {
83+
typeElement(rawType).getEnclosedElements().stream()
84+
.filter(e -> e.getKind() == ElementKind.FIELD)
85+
.filter(f -> !IgnorePrism.isPresent(f))
86+
.map(Element::asType)
87+
.map(UType::parse)
88+
.flatMap(u -> u.importTypes().stream())
89+
.forEach(imports::add);
90+
}
91+
8392
TypeHandler initTypeHandler() {
8493

8594
if (specialParam) {

0 commit comments

Comments
 (0)