RockteMQ-AI commented on code in PR #3052:
URL:
https://github.com/apache/rocketmq-dashboard/pull/3052#discussion_r3928078625
##########
server/src/main/java/org/apache/rocketmq/studio/ops/ai/tool/TopicListToolHandler.java:
##########
@@ -79,4 +83,34 @@ private static String require(String value, String field) {
private static String blankIfNull(String value) {
return value == null ? "" : value;
}
+
+ private static Map<String, Object> pagedResult(PageResult<?> page,
List<Map<String, Object>> items) {
+ Map<String, Object> result = new LinkedHashMap<>();
+ result.put("items", items);
+ result.put("total", page.getTotal());
+ result.put("page", page.getPage());
+ result.put("size", page.getSize());
+ return result;
+ }
+
+ static int page(Map<String, Object> input) {
Review Comment:
The `pagedResult()`, `page()`, `pageSize()`, and `optionalPositiveInteger()`
helpers are duplicated across all three handler classes
(`TopicListToolHandler`, `ConsumerGroupListToolHandler`,
`AlertRuleListToolHandler`). Consider extracting them into a shared base class
(e.g. `AbstractPagedToolHandler`) or a utility class to reduce duplication and
make future changes (e.g. adjusting defaults or validation) a single-point edit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]