@@ -64,6 +64,11 @@ private boolean isMapType(String type) {
6464 return startsWithAny (type , MAP_TYPES );
6565 }
6666
67+ private static final String PAGEABLE_FQN = "io.rocketbase.commons.dto.PageableResult" ;
68+
69+ private boolean isPageable (String type ) {
70+ return type .startsWith (PAGEABLE_FQN ) || type .startsWith ("PageableResult" );
71+ }
6772
6873 private List <String > splitTopLevelGenerics (String typeWithGenerics ) {
6974 int lt = typeWithGenerics .indexOf ('<' );
@@ -136,7 +141,15 @@ public String getReturnType(String genericReturnType) {
136141 if (genericReturnType .equalsIgnoreCase ("java.lang.void" )) return "void" ;
137142 if (genericReturnType .equalsIgnoreCase ("java.lang.object" )) return "any" ;
138143
139- // --- Map<K,V> -> Record<K,V> ---
144+ if (isPageable (genericReturnType )) {
145+ String name = convertInfiniteReturnTypes (genericReturnType );
146+ List <String > inner = splitTopLevelGenerics (name );
147+ if (inner .isEmpty ()) return "PageableResult<unknown>" ;
148+ String t = getReturnType (normalizeWildcard (inner .get (0 )));
149+ return "PageableResult<" + t + ">" ;
150+ }
151+
152+ // ---- Map<K,V> -> Record<K,V> (dein neues Verhalten) ----
140153 if (isMapType (genericReturnType )) {
141154 List <String > kv = splitTopLevelGenerics (genericReturnType );
142155 if (kv .size () != 2 ) return "Record<string, any>" ;
@@ -177,10 +190,7 @@ public String getReturnType(String genericReturnType) {
177190 return t + "[]" ;
178191 }
179192
180- // --- dein bisheriger Default-Zweig ---
181- String name = convertInfiniteReturnTypes (genericReturnType );
182-
183- // (Optional) Falls du weiterhin getListTypes() verwenden willst, darf dieser Block stehen bleiben.
193+ String name = new String (genericReturnType );
184194 Optional <String > arrayType = getListTypes ().stream ()
185195 .filter (v -> genericReturnType .startsWith (v )).findFirst ();
186196 if (arrayType .isPresent ()) {
@@ -304,15 +314,16 @@ public Set<String> getImportTypes(Set<String> allTypes) {
304314 }
305315
306316 protected String convertImportWrappers (String type , Set <String > importTypes ) {
317+ if (type .startsWith (PAGEABLE_FQN + "<" ) || type .startsWith ("PageableResult<" )) {
318+ String inner = type .replaceFirst ("^.*PageableResult<" , "" ).replace (">" , "" );
319+ return inner ;
320+ }
307321 for (String p : COLLECTION_TYPES )
308322 if (type .startsWith (p + "<" )) return type .replace (p + "<" , "" ).replace (">" , "" );
309323 for (String p : STREAM_TYPES ) if (type .startsWith (p + "<" )) return type .replace (p + "<" , "" ).replace (">" , "" );
310324 for (String p : OPTIONAL_TYPES ) if (type .startsWith (p + "<" )) return type .replace (p + "<" , "" ).replace (">" , "" );
311325 for (String p : FUTURE_TYPES ) if (type .startsWith (p + "<" )) return type .replace (p + "<" , "" ).replace (">" , "" );
312326 for (String p : MAP_TYPES ) if (type .startsWith (p + "<" )) return type .replace (p + "<" , "" ).replace (">" , "" );
313- if (type .startsWith ("io.rocketbase.commons.dto.PageableResult<" )) {
314- return type .replace ("io.rocketbase.commons.dto.PageableResult<" , "" ).replace (">" , "" );
315- }
316327
317328 int lt = type .indexOf ('<' );
318329 if (lt >= 0 ) {
0 commit comments